Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.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
如果文本输入区域为空,ionic2/angular2中有没有简单的方法来禁用按钮?_Ionic2_Angular2 Forms_Disabled Control - Fatal编程技术网

如果文本输入区域为空,ionic2/angular2中有没有简单的方法来禁用按钮?

如果文本输入区域为空,ionic2/angular2中有没有简单的方法来禁用按钮?,ionic2,angular2-forms,disabled-control,Ionic2,Angular2 Forms,Disabled Control,我试图在按钮上使用*ngIf条件,以便在文本输入区域为空时禁用它,但似乎没有一种直接的方法来访问该输入值 <ion-item> <ion-label fixed>Venue</ion-label> <ion-input type="text" id="venue" [(ngModel)]="event.venue" class="form-control" maxlength="22" required></ion-input&g

我试图在按钮上使用*ngIf条件,以便在文本输入区域为空时禁用它,但似乎没有一种直接的方法来访问该输入值

<ion-item>

<ion-label fixed>Venue</ion-label>

    <ion-input type="text" id="venue" [(ngModel)]="event.venue" class="form-control" maxlength="22" required></ion-input> 

    </ion-item>

<button ion-button block id="addEventButton" *ngIf="//not sure what to do here// " (click)="addEvent();">Add Event</button>

地点
添加事件
是的,这会有用的

<button ion-button block id="addEventButton" [disabled]="!event.venue"></button>