【问题标题】:Any simple way in ionic2/angular2 to disable button if a text input area is empty?如果文本输入区域为空,ionic2/angular2 中是否有任何简单的方法可以禁用按钮?
【发布时间】:2017-11-01 16:26:27
【问题描述】:

我正在尝试在按钮上使用 *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>

【问题讨论】:

    标签: ionic2 angular2-forms disabled-control


    【解决方案1】:

    是的,这会起作用

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-01-09
      • 1970-01-01
      • 2018-09-03
      • 2011-12-13
      • 2022-08-19
      • 2019-02-06
      • 2018-05-21
      • 2011-08-29
      相关资源
      最近更新 更多