<div ng-controller="EventController"> Root scope <tt>MyEvent</tt> count: {{count}} <ul> <li ng-repeat="i in [1]" ng-controller="EventController"> <button ng-click="$emit('MyEvent')"> $emit('MyEvent') </button> <button ng-click="$broadcast('MyEvent')"> $broadcast('MyEvent') </button> <br> Middle scope <tt>MyEvent</tt> count: {{count}} <ul> <li ng-repeat="item in [1, 2]" ng-controller="EventController"> Leaf scope <tt>MyEvent</tt> count: {{count}} </li> </ul> </li> </ul></div>
4 回答
qq_彩虹的影子_0
TA贡献1条经验 获得超2个赞
[1]数组里有一个元素1,ng-repeat="i in [1]"遍历1次
[1,2]数组里有一个元素1,2,ng-repeat="i in [1,2]"遍历2次
- 4 回答
- 0 关注
- 4626 浏览
添加回答
举报
0/150
提交
取消