本文介绍了NG-禁用不出现工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图有条件地启用/禁用使用我的保存按钮NG-禁用:

I'm trying to conditionally enable/disable my Save button using ng-disabled:

<按钮式=按钮称号=保存更改NG点击=onSaveChanges()NG-禁用={{data.modified}!}>保存< /按钮>

我有一个$ scope.data.modified变量时,我的数据已被修改,改变为true。无论这是否是真还是假,保存按钮被启用。元素检查结果显示真与假如预期,但按键之间的NG-禁用切换的价值总是处于启用状态。

I have a $scope.data.modified variable that changes to true when my data has been modified. Regardless whether that is true or false, the Save button is enabled. Element inspection reveals that the value of ng-disabled toggles between "true" and "false" as expect but the button is always enabled.

推荐答案

当你使用一个角的js属性(如NG-显示,NG-躲,NG-禁用)应该是没有蛇符号例 NG-禁用=!data.modified。对于像其它同类普通属性,ID必须与蛇符号使用它。防爆。 类= {{} aVaribaleinControllerScope}

when you are using a angular js attribute (like ng-show, ng-hide, ng-disabled) it should be without the snake notation Ex.ng-disabled="!data.modified" . For other ordinary attribute like class, id you have to use it with the snake notation. Ex. class={{aVaribaleinControllerScope}}

这篇关于NG-禁用不出现工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 09:35