Reputation: 1258
I am fairly new to angular and am trying to figure out why this wont work. I have an array of objects and within these objects there are keys and their values:
$scope.groups = [
{
title: 'Meal 1',
content: 'Dynamic Group Body - 1',
show: false
},
{
title: 'Meal 2',
content: 'Dynamic Group Body - 2',
show: false
}];
I have created a method that I want to loop over the array and change the 'show' boolean values to true. This is the body of this method:
for(var x = 0 ; x < 2; x++){
$scope.groups[x].show = true;
}
however it doesn't seem to work, and can't seem to understand why!. I am very new to angular so excuse my naivety with it all.
Could someone show me how to fix this?
Upvotes: 0
Views: 295
Reputation: 104785
ngShow
is an Angular directive - you do not need the {{}}
when passing conditions:
<div ng-repeat="group in groups" ng-show="group.show">
Upvotes: 1