|
<div ng-app="" ng-controller="MainCtrl"> |
|
<!--"Parent1 --> |
|
<div class="parent1" ng-controller="ParentCtrl"> |
|
<label>Parent1({{count}}) {{msg}}</label> |
|
<div class="child1" ng-controller="ChildCtrl"> |
|
<label>Child1({{count}}) {{msg}}</label><br> |
|
<button ng-click="$emit('count p','child1')"> Call Parent Count with Emit on Child1</button><br> |
|
<button ng-click="$broadcast('count p','child1')"> Call Parent Count with Broadcast on Child1</button><br> |
|
|
|
<button ng-click="$broadcast('count c','child1')"> Call Child1 Count with Broadcast on Child1</button><br> |
|
|
|
<button ng-click="$emit('reset','emit reset of child1 ')"> Call Reset with Emit on Child1</button> |
|
<button ng-click="$broadcast('reset','broadcast reset of child1')">Call Reset with Broadcast on Child1</button> |
|
<div class="footer" ng-controller="InsideCtrl"> |
|
<label>Inside of Child1</label> <br> |
|
<button ng-click="$emit('reset','reset of inside')"> Call Reset with Emit on inside</button> |
|
</div> |
|
</div> |
|
<!-- Neighbor --> |
|
<div class="child1" ng-controller="ChildCtrl"> |
|
<label>Child1 Neighbor({{count}}) {{msg}}</label> <br> |
|
<button ng-click="$emit('count p','child1')"> Call Parent Count with Emit on Child1 Neighbor</button><br> |
|
<button ng-click="$broadcast('count p','child1 Neighbor')"> Call Parent Count with Broadcast on Child1 Neighbor</button><br> |
|
|
|
<button ng-click="$broadcast('count c','child1 Neighbor')"> Call Child1 Count with Broadcast on Child1 Neighbor</button><br> |
|
|
|
<button ng-click="$emit('reset','emit reset of child1 Neighbor')"> Call Reset with Emit on Child1 Neighbor</button> |
|
<button ng-click="$broadcast('reset','broadcast of reset child1 Neighbor')">Call Reset with Broadcast on Child1 Neighbor</button> |
|
<div class="footer" ng-controller="InsideCtrl"> |
|
<label>Inside of Child1 Neighbor</label> <br> |
|
<button ng-click="$emit('reset','reset of inside Neighbor')"> Call Reset with Emit on inside</button> |
|
</div> |
|
</div> |
|
</div> |
|
<hr> |
|
<!-- "Parent2 --> |
|
<div class="parent2" ng-controller="ParentCtrl"> |
|
<label>Parent2({{count}}) {{msg}}</label> |
|
<div class="child2" ng-controller="ChildCtrl"> |
|
<label>Child2({{count}}) {{msg}}</label><br> |
|
<button ng-click="$emit('count p','child2')"> Call Parent Count with Emit on Child2</button><br> |
|
<button ng-click="$broadcast('count p','child2')"> Call Parent Count with Broadcast on Child2</button><br> |
|
<button ng-click="$broadcast('count c','child2')"> Call Child2 Count with Broadcast on Child2</button><br> |
|
|
|
<button ng-click="$emit('reset','emit reset of child2 ')">Call Reset with Emit on Child2</button> |
|
<button ng-click="$broadcast('reset','broadcast reset of child2')"> Call Reset with Broadcast on Child2</button> |
|
<div class="footer" ng-controller="InsideCtrl"> |
|
<label>Inside of Child2</label> <br> |
|
<button ng-click="$emit('reset','reset of inside')"> Call Reset with Emit on inside</button> |
|
</div> |
|
</div> |
|
</div> |
|
<hr> |
|
<button ng-click="$broadcast('reset','broadcast reset of parent')"> Reset Broadcast</button> |
|
</div> |