How are delegates implemented?


I’d like to create a directive that I can control independent of which controller scope it is currently in. I’ve noticed that something like $ionicSideMenuDelegate lets me do this for the side menu (where the menu directive is under a higher scope than the controller to toggle it), but I can’t figure out how they fit together. What sort of object is the delegate exactly and how does it control the directive?


A good way to find out how everything fits together and works is to look at the source code.

Here you will see the directives and the delegates that are available to them