Angular directive for timer communication directive

I took the ideas from AngularJS - How to make a stopwatch starting at 00:00:00, and you need the timer to use the stop method to go to the parent directive for the button that is in the parent template.

<parent-container>
  <timer-container />
  <button ng-click="??.stopTimer()">Stop</button>
</parent-container>

If there is a method in the timer container that stops the timer, how will the parent container and the timer container interact with me so that the stopTimer method is called when the button is clicked?

0
source share
1 answer

$emit $broadcast . $emit , $broadcast . , $on.

, $rootScope .

, , .

+2

All Articles