angularJs ng-disabled无效

时间:2016-05-16 10:16:23

标签: javascript jquery html angularjs

{
    $scope.editable = true;
    $scope.NewEmployee = function () {
        $scope.editable = false;
    };

    $scope.EditEmployee = function () {
        $scope.editable = false;
        $scope.Employee.edit = true;
    };

    $scope.Cancel = function () {
        $scope.editable = true;
    };
}

<button ng-click="NewEmployee()"></button>
<button ng-click="EditEmployee()" ></button>
<button ng-click="Save()" ng-disabled="editable"></button>
<button ng-class="Cancel()" ng-disabled="editable"></button>

当只有NewEmployee()它的工作

但是我添加EditEmployee()Save()取消()其中一个不起作用

1 个答案:

答案 0 :(得分:2)

您的代码中存在TYPO错误

<button ng-class="Cancel()" ng-disabled="editable"></button>

ng-class="Cancel()"这应该像ng-click="Cancel()"