I am having an ng-repeat block and with it i am writing an ng-click with a direct expression of setting a $scope variable to true.. but it doesn't work.. can someone plz help.. here is the plnkr
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'
}
]
}
});
for now i am having a workaround to have a function call on its click and set the variable that is required, but curious to know whats wrong with the other approach?