Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I tried using async pipe and also track by
- // in the service
- getVehicles(){
- obj = { data: [{name: 'car 1'},{name: 'car 2'}] }
- return Observable.interval(2200).map(i=> obj.data.push({name: 'car 3'}));
- }
- // in the controller
- vehicles: Observable<Array<any>>
- ngOnInit() {
- this.vehicles = this._vehicleService.getVehicles().obj.data;
- }
- // in template
- <div *ngFor='let vehicle of vehicles | async'>
- {{vehicle.name}}
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement