微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

angular – 如何基于选择表单启用和禁用mat按钮

这是我的按钮:
<button class="example-20-width" mat-raised-button disabled>Edit Client</button>

如何根据选择的表格是否为emtry来控制它并禁用它?

这是我的字段形式:

<mat-form-field class="example-full-width">
                    <mat-select  placeholder="Select customer">
                      <mat-option *ngFor="let food of books.data" 
                          [value]="food.company">
                        {{food.company}}
                      </mat-option>
                      <mat-option >
                        </mat-option>
                    </mat-select>
   </mat-form-field>
如果你看 Angular Material Demos (button)这是一个较旧版本的角度metrail演示,有一个按钮执行此操作.

这个演示对应于(现在已经过时了)和andgulr github中的演示.见:github.com – Angular Material – src/demo-app/button

你可以简单地使用:

<button mat-button [disabled]="isdisabled">

其中isdisabled是组件中的布尔定义.

原文地址:https://www.jb51.cc/angularjs/140367.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐