【发布时间】:2015-04-01 16:09:19
【问题描述】:
我在 ng-click 中有一个变量设置为 true,但下面的 div 没有显示。我关注了this post,但它似乎在 ng-repeat 中不起作用?这是 plunker:http://plnkr.co/edit/90G1KAx9Fmf2SgRs5gYK?p=preview
angular.module('myAppApp', [])
.controller('MainCtrl', function ($scope) {
$scope.notes = [{
id: 1,
label: 'First Note',
done: false,
someRandom: 31431
}, {
id: 2,
label: 'Second Note',
done: false
}, {
id: 3,
label: 'Finished Third Note',
done: true
}];
$scope.reach= function (id) {
//the assignment below works
//$scope.flag = true;
alert("hello there");
};
});
<div ng-app="myAppApp">
<div ng-controller="MainCtrl">
<div ng-repeat="note in notes">
{{note.id}} - {{note.label}} -
<a href="#" ng-click="flag = true;reach(111);">click me</a>
</div>
<div class="row" id="" ng-show="flag">I'm Here</div>
</div>
</div>
【问题讨论】:
标签: angularjs ng-repeat angularjs-ng-show