I have implemented some intricate logic in a bootstrap dialog, which I have now separated into its own controller for better organization and isolation.
At times, I find the need to launch the dialog or execute a specific function within the controller based on certain conditions that arise elsewhere in the application - such as in another controller or service. I have managed to achieve this by assigning an id to the ng-controller element and then locating the element using that id, allowing me to call functions from the .scope() of that particular controller. To illustrate:
In the HTML:
<div id="modalController" ng-controller="modalController">
And in another service or controller:
angular.element("#modalController").scope().somefunction()
It seems rather odd to have to locate a controller by its id rather than by name. Is there perhaps a more conventional method to accomplish this?