Mustafa.psd
Mustafa.psd

Reputation: 49

Using two variable in *ngIf

<ion-col size="12" *ngFor="let day of weekdays">
     <h5>{{day | titlecase }}</h5>
     <ion-grid fixed>
         <ion-row>
         <ng-container *ngFor="let item of category.menu_items">
         <ion-col sizeLg="4" size="12" *ngIf="item.menu_item_books['0'].{{day}}">

I have a data like this:

item.menu_item_books['0'].monday: false 

I want using to use this data for showing element. I create an array:

weekdays = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];

I want using weekdays array's element in *ngIf. How can I do this?

Upvotes: 2

Views: 150

Answers (1)

Reaper
Reaper

Reputation: 412

you can write it like that

*ngIf="item.menu_item_books['0'][day]"

Upvotes: 3

Related Questions