I have a page that uses two controllers. One is associated with the header (which is reused on many different pages) and the other is associated with the body of the page. The mark-up looks something like:
<div id = 'header' ng-controller = 'headerController' >
<div id = 'login-button' ng-click = 'login()'>
Login
</div>
</div>
<div id = 'body' ng-controller = 'myPageController'>
....
</div>
The controllers are defined in two separate JS files respectively:
headerController.js
myPageController.js
I would like to bind a listener to the login()
function so that whenever the button associated with it is clicked, another function is called in the myPageController.js
file.
How would I go about doing this in Angular?