At the moment I have an app that has a sidebar, and the sidebar loads different html templates using ng-include
based on what operation the user chooses to do. It\'
I've forked your plunkr demo into one that I believe does what you're looking for: http://plnkr.co/edit/whsjBT?p=preview
This demonstrates an event being broadcast from one controller to another AFTER the 2nd controller (LegCtrl
in our example here) is loaded via ng-include
and passing it data.
I used $includeContentLoaded
event from ng-include to delay broadcasting the event until angular reports that add_leg.html
is loaded. Also I think there were some issues with how you were using $broadcast()
... it's first parameter should be the same as the one used in $on()
in LegCtrl
Another idea to consider is simply using your Navigation
service itself to share state between the controllers if that's appropriate in your scenario.