1
- import { Component , OnInit } from '@angular/core' ;
1
+ import { Component , inject } from '@angular/core' ;
2
2
import { MatDialog } from '@angular/material/dialog' ;
3
3
import { Router } from '@angular/router' ;
4
- import { select , Store } from '@ngrx/store' ;
5
- import { asyncScheduler , Observable } from 'rxjs' ;
4
+ import { Store } from '@ngrx/store' ;
5
+ import { asyncScheduler } from 'rxjs' ;
6
6
import { filter , map , observeOn } from 'rxjs/operators' ;
7
7
import { ApplicationState } from '../../state/app.state' ;
8
8
import { Project } from '../models/projects.model' ;
@@ -18,7 +18,7 @@ import {
18
18
import { AddProject , DeleteProject , EditProject } from '../state/projects.actions' ;
19
19
import { ProjectsSelectors } from '../state/projects.selectors' ;
20
20
import { MatIconButton } from '@angular/material/button' ;
21
- import { NgFor , AsyncPipe , PercentPipe } from '@angular/common' ;
21
+ import { NgFor , PercentPipe } from '@angular/common' ;
22
22
import { MatIcon } from '@angular/material/icon' ;
23
23
import { MatRipple } from '@angular/material/core' ;
24
24
import { MatCard , MatCardContent , MatCardActions } from '@angular/material/card' ;
@@ -40,22 +40,18 @@ import { FooterComponent } from 'src/app/shared/footer/footer.component';
40
40
MatCardContent ,
41
41
MatCardActions ,
42
42
MatIconButton ,
43
- AsyncPipe ,
44
43
PercentPipe ,
45
44
ToolbarComponent ,
46
45
ToolbarLogoComponent ,
47
46
ScoreChartComponent ,
48
47
FooterComponent
49
48
]
50
49
} )
51
- export class ProjectsViewComponent implements OnInit {
52
- projects$ : Observable < Array < Project > > ;
53
-
54
- constructor ( private store : Store < ApplicationState > , private router : Router , private dialog : MatDialog ) { }
55
-
56
- ngOnInit ( ) {
57
- this . projects$ = this . store . pipe ( select ( ProjectsSelectors . getProjects ) ) ;
58
- }
50
+ export class ProjectsViewComponent {
51
+ private store = inject < Store < ApplicationState > > ( Store ) ;
52
+ private router = inject ( Router ) ;
53
+ private dialog = inject ( MatDialog ) ;
54
+ projects = this . store . selectSignal ( ProjectsSelectors . getProjects ) ;
59
55
60
56
navigateToProject ( projectId : string ) {
61
57
this . router . navigate ( [ `/${ projectId } /checklist` ] ) ;
0 commit comments