Skip to content

Instantly share code, notes, and snippets.

@brandonroberts
Last active March 3, 2019 20:31
Show Gist options
  • Save brandonroberts/ff8d1f4381168d28f72deaa719d0b618 to your computer and use it in GitHub Desktop.
Save brandonroberts/ff8d1f4381168d28f72deaa719d0b618 to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-movies-page',
template: `
<h1>Movies Page</h1>
<div *ngIf="error">
{{ error }}
</div>
`
})
export class MoviesPageComponent implements OnInit {
error = '';
constructor(
private store: Store<fromRoot.State>,
actions$: Actions
) {
actions$.pipe(
ofType('[Movies/API] Load Movies Failure'),
).subscribe(action => this.error = action.payload);
}
ngOnInit() {
this.store.dispatch({ type: '[Movies Page] Load Movies' });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment