Implementation

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

mkdir angular-observable ng init ng serve

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, which is the same as we did for the getters and setters:

export class Movie {     public constructor(         private _movie_id:number,         private _title: string,         private _phase: string,         private _category_name: string,         private _release_year: number,         private _running_time: number,         private _rating_name: string,         private _disc_format_name: string, private _number_discs: number, ...

Get Angular Design Patterns 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.