角4剑道对话框禁用操作按钮 [英] angular 4 Kendo dialog disable action button
本文介绍了角4剑道对话框禁用操作按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果'TotalUnits'<我想禁用保存"按钮. 0.如何禁用保存"按钮?
I want disable 'Save' button if 'TotalUnits' < 0 . How can I disable actions 'Save' button?
主要组件:
AllocationDialog(data: any) {
const dialog: DialogRef = this.component.dialogService.open({
title: ' Allocations',
content: AllocationComponent,
actions: [
{ text: 'Save', primary: true, data },
],
width: 500,
height: 500
});
dialog.result.subscribe((dialogResult) => {
if (dialogResult instanceof DialogCloseResult) {
console.log('close');
} else {
console.log('action', dialogResult);
}
});
const allocationsInfo = dialog.content.instance;
allocationsInfo.TotalUnits = data.TotalUnits;
}
AllocationComponent-对话框:
AllocationComponent - Dialog:
@Input() public TotalUnits: number;
<input kendoTextBox [(ngModel)]="TotalUnits" />
推荐答案
要禁用输入时,可以将[disabled]
属性绑定添加到要禁用的标签上.
When you want to disable an input you can add the [disabled]
attribute binding to the tag you wish to disable.
在您的情况下,应遵循以下几条原则:
In your case something along these lines should work:
<input kendoTextBox [disabled]="TotalUnits < 0" [(ngModel)]="TotalUnits" />
I'm not particularly familiar with Kendo but you can check their documentation for more examples.
这篇关于角4剑道对话框禁用操作按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文