I have object array in my Angular2 application. I am using SignalR to fill array when new object arrives. Now the point is when new object arrived I had error
cannot read property of undefined
I rode that it might be error because its working async and in html I used to take object inside object.
So now the code look like:
<div *ngFor="let event of events">
<div class="card overview">
<div class="overview-content clearfix ">
<span class="overview-title" pTooltip="{{event.name}}">{{(event | async)?.user?.name}} / {{(event | async)?.date | date:"HH:mm" }}</span>
<span class="overview-badge "> <i class="material-icons ">{{getActivityIcon(event.activityId)}}</i>
<button type="button" pButton (click)="selectEvent($event,event,op);" icon="fa-search"></button>
</span>
</div>
</div>
</div>
And now the error is
NgFor only supports binding to Iterables such as Arrays.
My object array is in component and look as below:
events: Observable<Event[]>;
I understand the error but how can I make it work now?
| asyncat the end of your *ngForeventsis not initialized in your component, show more code