ng-controller 重复指定
<div ng-controller="EventController"> Root scope <tt>My Event</tt> count: {{count}} <ul> <li ng-repeat="i in [1]" ng-controller="EventController"> <button ng-click="$emit('MyEvent')"> $emit('MyEvent');{{i}} </button> <button ng-click="$broadcast('MyEvent')"> $broadcast('MyEvent'){{i}} </button> <br /> Middle Scope <tt>MyEvent</tt> count: {{count}} <ul> <li ng-repeat="item in [1, 2]" ng-controller="EventController"> Left scope {{item}} <tt>MyEvent</tt> count: {{count}} </li> </ul> </li> </ul> </div>
为什么在ng-repeat 的li标签中还要写一个一样ng-controller呢?在根div中不是已经制定ng-controller了吗?