Joe82 Joe82 - 2 days ago 6
AngularJS Question

AngularJS - change scope value when its key is true within another scope

I have a ng-repeat like this

<li ng-repeat="car in cars">
<p>{{car.model}}</p>
<span ng-show="car.check">

Answer

I've updated your jsFiddle.

Basically just updated your $scope.checkProducerTrue function to:

$scope.checkProducerTrue = function(c) {
   angular.forEach($scope.filter.producers, function(value, key) {
       if (key == c.model) c.check = value;
   });
};
Comments