1- import { Component , OnInit } from '@angular/core' ;
1+ import { Component , inject } from '@angular/core' ;
22import { MatDialog } from '@angular/material/dialog' ;
33import { 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' ;
66import { filter , map , observeOn } from 'rxjs/operators' ;
77import { ApplicationState } from '../../state/app.state' ;
88import { Project } from '../models/projects.model' ;
@@ -18,7 +18,7 @@ import {
1818import { AddProject , DeleteProject , EditProject } from '../state/projects.actions' ;
1919import { ProjectsSelectors } from '../state/projects.selectors' ;
2020import { MatIconButton } from '@angular/material/button' ;
21- import { NgFor , AsyncPipe , PercentPipe } from '@angular/common' ;
21+ import { NgFor , PercentPipe } from '@angular/common' ;
2222import { MatIcon } from '@angular/material/icon' ;
2323import { MatRipple } from '@angular/material/core' ;
2424import { MatCard , MatCardContent , MatCardActions } from '@angular/material/card' ;
@@ -40,22 +40,18 @@ import { FooterComponent } from 'src/app/shared/footer/footer.component';
4040 MatCardContent ,
4141 MatCardActions ,
4242 MatIconButton ,
43- AsyncPipe ,
4443 PercentPipe ,
4544 ToolbarComponent ,
4645 ToolbarLogoComponent ,
4746 ScoreChartComponent ,
4847 FooterComponent
4948 ]
5049} )
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 ) ;
5955
6056 navigateToProject ( projectId : string ) {
6157 this . router . navigate ( [ `/${ projectId } /checklist` ] ) ;
0 commit comments