Skip to content Skip to sidebar Skip to footer

Angular Directive To Directive Communication For Timer

I have taken the ideas from AngularJS - How to make a stop watch starting from 00:00:00 format and have a need to have the timer be able to have a stop method go up to the parent d

Solution 1:

Look into the $emit and $broadcast functions. $emit will send an event up the heirarchy and $broadcast sends the event down the heirarchy. You can add a listener using the $on function.

If there is no direct relation between the two scopes, you can inject $rootScope into both controllers and handle the event there.

For a more complete example, check the answer I linked in my comment.

Post a Comment for "Angular Directive To Directive Communication For Timer"