0

I am confused about the emit event in scope.

For example the structure.

<scope00></scope00>
<scope0>
<scope1>
  <scope2>
    <scope3>
       <scope4></scope4>
    </scope3>
    <scope4>

    </scope4>
  </scope2>
</scope1>
</scope0>

So my question is,

$scope2.$emit("myevent", data);

What are the scopes can capture this "myevent"?

and what would be the difference between $scope0.$emit and $scope2.$emit.

user3686652
  • 805
  • 1
  • 6
  • 11

1 Answers1

0

From the docs of $emit

emit-Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners

So scope1 and scope0 can capture 'myevent' if emitted from scope2...

Also give this answer a read Working with $scope.$emit and $scope.$on

Community
  • 1
  • 1
Srinath Mandava
  • 3,384
  • 2
  • 24
  • 37