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
| export class HeroesEffects { | |
| @Effect() | |
| fetch$: Observable<HeroesActions> = this.actions$ | |
| .ofType(HeroesActionTypes.FetchHeroes) | |
| .pipe( | |
| withLatestFrom(this.store), | |
| switchMap(([action, state]) => | |
| this.service.getHeroes(getCurrentPage(state)).pipe( | |
| map(data => new FetchHeroesSuccess(data)), | |
| catchError(err => of(new FetchHeroesError(err))) |
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
| export const getHeroesState = createFeatureSelector<fromHeroes.State>('heroes'); | |
| export const getHeroes = createSelector(getHeroesState, state => state.data); | |
| export const getIsLoading = createSelector(getHeroesState, state => state.isLoading); | |
| export const getCurrentPage = createSelector(getHeroesState, state => state.page); | |
| export const getIsFirstPage = createSelector(getHeroesState, state => !state.previous); | |
| export const getIsLastPage = createSelector(getHeroesState, state => !state.next); |
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
| ngOnInit() { | |
| this.heroes$ = this.store.select(getHeroes); | |
| this.isFirst$ = this.store.select(getIsFirstPage); | |
| this.isLast$ = this.store.select(getIsLastPage); | |
| this.isLoading$ = this.store.select(getIsLoading); | |
| this.store.dispatch(new FetchHeroes()); | |
| } |
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
| prev() { | |
| this.store.dispatch(new ChangePage(Pagination.PREV)); | |
| } | |
| next() { | |
| this.store.dispatch(new ChangePage(Pagination.NEXT)); | |
| } |
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
| [ignore] | |
| .*/node_modules/fbjs/.* | |
| [options] | |
| esproposal.class_static_fields=enable | |
| esproposal.class_instance_fields=enable | |
| [untyped] | |
| .*/node_modules/.* |
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
| { | |
| "javascript.validate.enable": false, | |
| "flow.pathToFlow": "${workspaceRoot}/node_modules/.bin/flow", | |
| "flow.stopFlowOnExit": true, | |
| "flow.enabled": true, | |
| "flow.useNPMPackagedFlow": false, | |
| "flow.showStatus": true, | |
| "flow.showUncovered": false, | |
| "flow.runOnEdit": true, | |
| "flow.useLSP": false |
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
| <ul> | |
| <li *ngFor="let item of Items | keyvalue"> | |
| {{item.key}}: {{item.value}} | |
| </li> | |
| </ul> |