July 2018
Intermediate to advanced
178 pages
3h 52m
English
Let's break it down chunk by chunk. First, the declaration of the service is pretty standard:
import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import { Movie, MovieFields } from '../models/movie'; import { Observable } from 'rxjs/Rx'; import 'rxjs/Rx'; @Injectable() export class IMDBAPIService { private moviesUrl:string = "app/marvel-cinematic-universe.json"; constructor(private http: Http) { }
Services are injectable. Consequently, we need to import and add the @Injectable annotation. We also import Http, Movie, MovieFields, Observable, and the operators of Rxjs. RxJS stands for reactive extensions for JavaScript. It is an API to perform observer, iterator, and functional ...
Read now
Unlock full access