当ng-disable被触发时?

时间:2015-09-03 11:32:35

标签: javascript angularjs

例如我有:

<button ng-disabled="!isSomethingValid() || loading || disabled" ... class="btn btn-primary">

但是,ng-disable属性评估它的表达式的条件是什么?

1 个答案:

答案 0 :(得分:0)

ng-disabled用于在值返回true时禁用DOM元素。

    <button ng-disabled="mySwitch">Click Me!</button>
    <button type = "text" ng-click = "fnDemo();">Button</button>

$scope.mySwitch = true;

$scope.fnDemo = function(){
   $scope.mySwitch = !$scope.mySwitch; 
};