angular - How to show/hide element depending on if the value is not undefined on angular2? -
i have code show weekly hour if value not undefined. however, ngif
check still show undefined
on element. tried *ngif="item.weeklyhour !== undefined"
undefined
still shows up. missing?
<span class="c-f__weekly-hour" *ngif="item.weeklyhour"> {{item.weeklyhour}} </span>
use ?
operator
<span class="c-f__weekly-hour" *ngif="item?.weeklyhour">
here plunker ,
please open app.ts file , review output commenting , uncommenting item object.
Comments
Post a Comment