gpt4 book ai didi

javascript - angularJs ng-禁用不工作

转载 作者:行者123 更新时间:2023-11-30 16:04:26 24 4
gpt4 key购买 nike

{
$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() Cancel() 其中之一它不起作用

最佳答案

您的代码中有一个 TYPO 错误

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

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

关于javascript - angularJs ng-禁用不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37251507/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com