import { Component , ChangeDetectionStrategy } from '@angular/core' ; import { Select } from '@ngxs/store' ; import { Observable } from 'rxjs' ; import { CounterFacade } from './counter.facade' ; import { CounterState , CounterStateModel } from '../counter.state' ; @ Component ( { selector : 'app-counter' , templateUrl : './counter.component.html' , changeDetection : ChangeDetectionStrategy . OnPush } ) export class CounterComponent { @ Select ( CounterState ) counter$ ! : Observable < CounterStateModel > ; constructor ( private counterFacade ) { } increment ( ) { this . counterFacade . increment ( ) ; } decrement ( ) { this . counterFacade . decrement ( ) ; } incrementAsync ( ) { this . counterFacade . incrementAsync ( ) ; } }