Skip to content

Instantly share code, notes, and snippets.

@FunnyGhost
Last active March 12, 2019 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FunnyGhost/0951dd450a90e575d64d4a1813b5d791 to your computer and use it in GitHub Desktop.
Save FunnyGhost/0951dd450a90e575d64d4a1813b5d791 to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-favorite-movies',
templateUrl: './favorite-movies.component.html',
styleUrls: ['./favorite-movies.component.scss']
})
export class FavoriteMoviesComponent implements OnInit {
favoriteMovies$: Observable<Movie[]>;
error: string;
constructor(private favoriteMovieService: FavoriteMoviesService) {}
ngOnInit() {
this.favoriteMovies$ = this.favoriteMovieService.getFavoriteMovies().pipe(
catchError((error: any) => {
this.error = error;
return of([]);
})
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment