Having some trouble with an ng-repeat block and setting a $scope variable to true with an ng-click expression. It doesn't seem to be working as expected. Can anyone help out? Check the plnkr for more information.
HTML:
selected: {{selected}}
<ul>
<li ng-repeat="t in t.header" ng-click="selected = true;">{{t.a1}}</li>
</ul>
JS:
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.selected = false;
$scope.t = {
header: [
{
a1:'a1'
},
{
a1:'a1'
}
]
}
});
Currently using a workaround with a function call on click to set the required variable. Curious to know why the direct assignment is not working properly?