我有简单的控制器代码:
JS
$scope.showErrorAlert = false;
$scope.switchBool = function(value) {
value = !value;
};
HTML
<div class="alert alert-error" ng-show="showErrorAlert">
<button type="button" class="close" data-ng-click="switchBool(showErrorAlert)" >×</button>
<strong>Error!</strong> {{errorTextAlert}}
</div>
从代码片段中您可以看到我尝试更改$scope.showErrorAlert
值。
但是它不起作用,value
改变但不是showErrorAlert
。
谁能告诉我为什么以及如何使它工作?
谢谢