Run function in local controller from side menu


#1

Hi, I’m looking for a way to make selecting an option on a side menu run a function in the current controller, which is in a sub-scope of the page showing the side menu. As an example, I have an app which display details of various jobs. On the right-hand side menu I want to offer options to interact with the job currently being shown. This right side menu is only used on the job display page.

When I link a button in the side menu to a function using ng-click, it looks for it in the controller linked to the top-level page where the side menu is defined. How can I make it look for that function in the controller responsible for the current view instead?

I guess I could use broadcast, but it doesn’t feel right. Also I’m worried that if a user scrolls through a bunch of jobs, and they all subscribe to the broadcast, they might all get fired when the user clicks the button.