问题描述:

I'm having difficulty solving this problem. I have for instance, a set of items I can add to a shopping cart. Then I can edit these Items, so I have a controller and a view for each type of item. Inside this controller I'm doing something like $scope.item=$scope.$parent.item; The problem is that if I have 2 of the same items the controller only runs once if I click between them, thus not updating the $scope.item.

How do I make it run every time I click on the item?

EDIT

I'm using ng-include for adding the view, and using <div ng-controller="ItemCtrl"> Can that be the case? I guess since it is the same template in ng-include the view doesn't reload and the controller doesn't re init.

相关阅读:
Top