Reputation: 425
I am in Ionic 3 and have a loop in my HTML:
<button ion-button *ngFor="let button of menuItems" (click)="presentPopover($event,button.children)">
<ion-icon name="wind-flag"><div class="active">100%</div></ion-icon>
</button>
I'd like to turn off the click handler if my 'button.children' array count is zero. I have had a good look around and as this angular approach is new to me, I'm having not a lot of luck. Thanks in advance.
Furthering this id like it to show me the array node button.link, grrr I cant see how!! I wrap it in {{ }} and it errors.
button.children.length > 0 ? presentPopover($event,button.children) : {{ button.link }}
Upvotes: 1
Views: 328
Reputation: 58523
You can do it like :
(click)="button.children.length > 0 ? presentPopover($event,button.children) : false"
Upvotes: 1