I have a login form directive with its own controller. The controller basically does the user login when the form is submittted fine. This works absolutely fine.
I am trying to contain my user login / logout functions in one controller in this case the LoginCtrl. I have a logout button outside the directive somewhere in the header part. Is it possible for me to call the doLogout() function within the LoginCtrl when that button is clicked ?
The only solution I have so far is to broadcast event on the rootScope and listen for the same on the LoginCtrl.
Any other alternatives ?