Using an array from Observable Object with ngFor and Async Pipe Angular 2 Using an array from Observable Object with ngFor and Async Pipe Angular 2 angular angular

Using an array from Observable Object with ngFor and Async Pipe Angular 2


Here's an example

// in the servicegetVehicles(){    return Observable.interval(2200).map(i=> [{name: 'car 1'},{name: 'car 2'}])}// in the controllervehicles: Observable<Array<any>>ngOnInit() {    this.vehicles = this._vehicleService.getVehicles();}// in template<div *ngFor='let vehicle of vehicles | async'>    {{vehicle.name}}</div>


Who ever also stumbles over this post.

I belive is the correct way:

  <div *ngFor="let appointment of (_nextFourAppointments | async).availabilities;">     <div>{{ appointment }}</div>  </div>


I think what u r looking for is this

<article *ngFor="let news of (news$ | async)?.articles"><h4 class="head">{{news.title}}</h4><div class="desc"> {{news.description}}</div><footer>    {{news.author}}</footer>