我在ng-click中設置了一個變量true,但是下面的div沒有顯示。我遵循this post,但它看起來不起作用,也許ng-repeat?這裏的plunker:http://plnkr.co/edit/90G1KAx9Fmf2SgRs5gYK?p=previewangularjs-ng-show不能與ng-repeat配合使用
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>