Only show restaurants with menus for the given days
This commit is contained in:
parent
75b960a0f1
commit
f498ecbfe7
16887
package-lock.json
generated
16887
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -3,4 +3,5 @@
|
||||
<button type="button" class="btn btn-info" (click)="getAllDaysUpdate()" style="margin-right: 10px;">Show whole week</button>
|
||||
<button type="button" class="btn btn-info" (click)="getTodayOnlyUpdate()">Only show today</button>
|
||||
</div>
|
||||
<app-restaurant *ngFor="let restaurant of restaurants; let i = index" [restaurant]="restaurant" [index]="i"></app-restaurant>
|
||||
<app-restaurant *ngFor="let restaurant of filterRestaurantsWithMeals(); let i = index" [restaurant]="restaurant" [index]="i"></app-restaurant>
|
||||
<div *ngIf="filterRestaurantsWithMeals().length == 0">No daily menus today :(</div>
|
||||
|
@ -45,4 +45,8 @@ export class RestaurantsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
filterRestaurantsWithMeals(): Restaurant[] {
|
||||
return this.restaurants.filter(r => r.daily.filter(d => d.meals.length != 0).length != 0)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user