Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created June 27, 2016 07:00
Show Gist options
  • Save tkssharma/486d054278ab346de2a56c39050b5205 to your computer and use it in GitHub Desktop.
Save tkssharma/486d054278ab346de2a56c39050b5205 to your computer and use it in GitHub Desktop.
ngOnInit() {
...
this.getBooksAndMovies(); // <-- add this line
}
getBooksAndMovies() {
Observable.forkJoin(
this.http.get('/app/books.json').map((res:Response) => res.json()),
this.http.get('/app/movies.json').map((res:Response) => res.json())
).subscribe(
data => {
this.books = data[0]
this.movies = data[1]
},
err => console.error(err)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment