Arrays 在ngFor循环中单击“离子关闭”按钮
我在爱奥尼亚3中,在我的HTML中有一个循环:Arrays 在ngFor循环中单击“离子关闭”按钮,arrays,angular,ionic-framework,Arrays,Angular,Ionic Framework,我在爱奥尼亚3中,在我的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>
<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>
你可以这样做:
(click)="button.children.length > 0 ? presentPopover($event,button.children) : false"
哈哈,谢谢你的夸奖,快乐编码顺便说一句:)。你可以用:
[disabled]=“button.children.length==0”
禁用按钮。我卸下了大括号,它还在工作,我只是没有在我的推送功能中包装它:button.children.length>0?presentPopover($event,button.children):按钮页(button.link)
(click)="button.children.length > 0 ? presentPopover($event,button.children) : false"