Skip to content

Instantly share code, notes, and snippets.

@thecodinganalyst
Created June 13, 2022 01:34
Show Gist options
  • Save thecodinganalyst/092a650e304f86755d16d764d5215f33 to your computer and use it in GitHub Desktop.
Save thecodinganalyst/092a650e304f86755d16d764d5215f33 to your computer and use it in GitHub Desktop.
NgRx ngOnInit
ngOnInit(): void{
this.loadBooks();
this.store.select(Selector.books).subscribe(books => this.books$ = books);
this.store.select(Selector.selectedBook).subscribe(book => {
this.selectedBook = book;
});
this.store.select(Selector.showDetail).subscribe(showDetail => {
this.showDetail = showDetail;
showDetail ? this.showPopup() : this.hidePopup();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment