这是我的垫子按钮:
<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) ,这是 Angular Material 演示的旧版本,有一个执行此操作的按钮。
该演示曾经对应(现已过时)Angular GitHub 页面上的演示,请参阅:github.com - Angular Material - src/demo-app/button .
您可以简单地使用:
<button mat-button [disabled]="isDisabled">
其中 isDisabled
是组件中的 bool 定义。
关于angular - 如何启用和禁用基于选择表单的垫按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49071267/