Last active
July 26, 2018 14:14
-
-
Save YonathanMeguira/8b0cfc47f6fb69c922da5c0dafc37965 to your computer and use it in GitHub Desktop.
shoppingComponent.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit, ChangeDetectionStrategy, Output, EventEmitter } from '@angular/core'; | |
import { ListQuery, ListState, List } from '../state'; | |
import { Observable } from 'rxjs'; | |
import { ShopikaService } from '../state/shopika.service'; | |
import { ID } from '@datorama/akita'; | |
@Component({ | |
selector: 'app-list', | |
templateUrl: './list.component.html', | |
styleUrls: ['./list.component.css'], | |
changeDetection: ChangeDetectionStrategy.OnPush | |
}) | |
export class ListComponent implements OnInit { | |
list$: Observable<List[]>; | |
newListRequest: boolean; | |
@Output() select = new EventEmitter<ID>(); | |
constructor(private query: ListQuery, private service: ShopikaService) { } | |
ngOnInit() { | |
this.list$ = this.query.selectAll(); | |
} | |
selectList(id: ID) { | |
this.select.emit(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment