0
为什么我不能使用函数更改值? AngularJS为什么我不能使用函数来改变值? AngularJS
HTML:
<div ng-controler='TestCtrl' id='TestCtrl'>
<h1>Test: {{test.name}}</h1>
<div ng-hide='showTest'>
<div class='content'>
<p>First name: <input ng-model='firstName'></p>
<p>Last name: <input ng-model='lastName'></p>
</div>
<div jq-ui-button ng-click='doSth()'>
Do something
</div>
</div>
</div>
JS:
app.controller('TestCtrl', function ($scope) {
$scope.showTest = false;
$scope.test = {name:'Test name'};
$scope.doSth = function() {
$scope.showTest = true;
}
}
它不工作。但是当我写:
<div jq-ui-button ng-click='showTest = true'>
它的工作。
问题在哪里?
谢谢。我搜索了错误时间。 – Niezborala
@Niezbor我也知道这些情况:) – michael