Implementation

Let's dive into the implementation. First, we will need to create a new Angular2 project using the Angular CLI:

    ng new angular-observable
    ng init
    ng serve
  

Then, to make sure everything went well, you can browse to localhost:4200 and see if you got something like the following:

Next, we will need a model to represent the movie concept. We will generate this class using the ng g class models/Movie command-line. Then, we can add a constructor defining all the private fields of the Movie models as the same as the getters and setters:

 export class Movie { public constructor( private _movie_id:number, private _title: string, private ...

Get Expert Angular now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.