import { Component , OnInit } from '@angular/core' ; import { DataService } from './data.service' ; @ Component ( { selector : 'app-root' , templateUrl : './app.component.html' , } ) export class AppComponent implements OnInit { films : any [ ] = [ ] ; selectedFilm : any = null ; constructor ( private dataService ) { } ngOnInit ( ) { this . dataService . getFilms ( ) . subscribe ( films => this . films = films ) ; } }