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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -