Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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
Angular 离子3中基于多个条件的点击事件(角度)_Angular_Ionic Framework_Angular Directive - Fatal编程技术网

Angular 离子3中基于多个条件的点击事件(角度)

Angular 离子3中基于多个条件的点击事件(角度),angular,ionic-framework,angular-directive,Angular,Ionic Framework,Angular Directive,在我的ionic应用程序中,我希望有一个基于条件的单击事件 <div class='class1' *ngIf='cndtn != "undefined"' (click)='cndtn1 && cndtn2 then functionToCall()'> <ion-icon class='icon-location'></ion-icon>{{xxxx}} <

在我的ionic应用程序中,我希望有一个基于条件的单击事件

        <div class='class1' *ngIf='cndtn != "undefined"' 
          (click)='cndtn1 && cndtn2 then functionToCall()'>
          <ion-icon class='icon-location'></ion-icon>{{xxxx}}
          <ion-icon class='icon-arrow-right floatRight iconArrowRight'></ion-icon>
        </div>

{{xxxx}

在上面的代码中,
functionToCall
只应在
cndtn1和&cndtn2
满足以下条件时执行:
functionToCall()
为什么不直接调用
functionToCall()
然后检查
cndtn1
cndtn2
。比如:

functionToCall() {
   if (!cndtn1 || !cndtn2) {
       return;
   else {
   // do something
   }
}

还有许多其他的函数需要设置相同的条件…所以我想在html文件而不是ts文件中管理它。我们可以做一些类似于
(单击)=“cndtn1&&cndtn2?func():xxx”
?@RageshPikalmunde的事情吗?是的,我相信这是有效的语法。