There are lots of opinions about how to write good Angular code. One of the best style guides out there is the one created by John Papa available at https://github.com/johnpapa/angularjs-styleguide.
It contains a large list of great tips about naming guidelines, application structure, testing, exception handling, and so on…
One advice that I started to implement recently is the usage of ‘Controller Activation Promises’. It solves the problem where you have your start-up logic scattered around across the controller. It places all start-up logic in a consistent place.
How do you this? Simple, create an activate() function and put all your start-up logic inside: