bicycle
bicycle

Reputation: 8430

$scope is not updated in Modal after second $scope change in Angularjs

I've been breaking my head for a long time with this but I can't find the solution. Please check this fiddle. If you click into the box, a list of categories appears. Then if you select a value, it's copied to categoryFilter through

$scope.categoryDropDownClickEvent = function(value) {                   
        $scope.categoryFilter = value;
        console.log($scope.categoryFilter);
    };

Then if you erase it and select it again, it doesn't work anymore though the scope itself is updated (see console). How come?

Upvotes: 0

Views: 119

Answers (1)

Martijn
Martijn

Reputation: 24789

I've made an update to your fiddle. Basically what I've done is created an object on the scope variable:

$scope.filter.name. I think that the problem you're experiencing has something to do with scope inheritance. ng-repeat creates a new scope for every iteration.

Upvotes: 1

Related Questions