Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 在ngFor循环中单击“离子关闭”按钮_Arrays_Angular_Ionic Framework - Fatal编程技术网

Arrays 在ngFor循环中单击“离子关闭”按钮

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>

我在爱奥尼亚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>
你可以这样做:

(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"