My question is how I can display data in the template if the observable after filtered does not return any data. The observable showed below retrieves data from the firebase realtime db if the filter condition is met. It works when data is obtained. What I need is to display the data when the observable does not return the data. I have commented below the data i want to show. Thank you
Eventdata: Observable<any[]>;
this.Eventdata = this.upSvc.getUserEvents(this.authentication.currentUserId)
.map(items => items.filter(item => item.eventId == this.eventId))
.filter(items => items && items.length > 0);
console.log(this.Eventdata);
<div *ngIf="Eventdata === undefined;else dataAfterValue;">
<div *ngFor="let item of Eventdata | async">
<button type="button" [disabled]="item.attending"
(click)="AttendEvent(evenDetails.EventId)" class="btn btn-primary
font-weight-light ">
{{item.attending? 'Already Registered' : 'Register'}}
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<button type="button" *ngIf="item.attending"
(click)="AttendEvent(evenDetails.EventId)" class="btn btn-danger
font-weight-light ">
Cancel Attendance
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<button type="button" (click)="shareEvent()" class="btn btn-info
font-weight-light ">
Share
<i class="fa fa-share-alt" aria-hidden="true"></i>
</button>
<button type="button" [disabled]="item.bookmarked"
(click)="bookmarkEvent(evenDetails.EventId)" class="btn btn-warning
font-weight-light ">
{{item.bookmarked? 'Already Bookmarked' : 'Bookmark'}}
<i class="fa fa-bookmark" aria-hidden="true"></i>
</button>
</div>
</div>
--- Data to SHOW ---------------
<ng-template #dataAfterValue>
<div>
<button type="button" (click)="AttendEvent(evenDetails.EventId)"
class="btn btn-primary font-weight-light ">
Register
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<button type="button" (click)="shareEvent()" class="btn btn-info font-
weight-light ">
Share
<i class="fa fa-share-alt" aria-hidden="true"></i>
</button>
<button type="button" (click)="bookmarkEvent(evenDetails.EventId)"
class="btn btn-warning font-weight-light ">
Bookmark
<i class="fa fa-bookmark" aria-hidden="true"></i>
</button>
</div>
</ng-template>