From 63fd79de4d39f91d1634705b11a99f3fa4499b49 Mon Sep 17 00:00:00 2001 From: Alain Chautard Date: Mon, 29 Jan 2018 11:45:01 -0800 Subject: [PATCH] Solution for lab #14 --- src/app/app.component.html | 2 +- src/app/app.component.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 823b30a..2beea87 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -5,7 +5,7 @@
- diff --git a/src/app/app.component.ts b/src/app/app.component.ts index fb1677e..6304884 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,6 +1,7 @@ import { Component } from '@angular/core'; import {LicensePlate} from './license-plate'; import {LicensePlateService} from './license-plate.service'; +import {Observable} from 'rxjs'; @Component({ selector: 'app-root', @@ -8,11 +9,9 @@ import {LicensePlateService} from './license-plate.service'; }) export class AppComponent { - licensePlates: LicensePlate[]; + licensePlates: Observable; constructor(private service: LicensePlateService) { - this.service.getList().subscribe( (data) => { - this.licensePlates = data; - }); + this.licensePlates = this.service.getList(); } }