2017-05-18 31 views
-1

我正在与剑道ui和角度的web项目工作。我有一个弹出式窗体,当我点击编辑选项时就会看到。我想根据我的discount专栏将我的弹出窗口设置为不可编辑。如果折扣的价值是false我应该能够编辑弹出窗口的值,否则我不应该能够编辑它。剑道角度只读属性

这是我plunker网址:http://plnkr.co/edit/yBTf4BbQB7xvQZyHRJXi?p=preview

任何帮助,将不胜感激。

谢谢。

回答

1

在GridEditFormComponent中,您将获得产品模型作为输入。你只需要检查模型值和禁用/启用形式:

@Input() public set model(product: Product) { 
    this.editForm.reset(product); 

    this.active = product !== undefined; 

    // if(product) checks if product is not null or undefinded here 
    if(product && product.Discontinued) { 
     this.editForm.disable(); 
    } 
    else { 
     this.editForm.enable(); 
    } 
} 

http://plnkr.co/edit/cA7VzJnFWBFctSZlfrjm?p=preview