angular-ui/ui-router — pull request #588 by rileylark (2013-11-17 03:38:34+00:00)
Title: Allow controller or controllerProvider to be/return a promise

I have a controllerProvider that needs to load a resource before it can determine which controller to use. This commit understands promises as return values from controllerProviders, and, incidentally, from controllers.

I understand that I could have worked around this with the resolve parameter, but this seemed a more natural way to declare my loading requirements. To use the resolve parameters, it was feeling like I had to basically inject a function that loaded the resources I need, determined the correct controller name, and then vacuously passed the controller name to the controllerProvider to be finally returned. I can see it both ways and won't be offended if you all like requiring resolve. Pretty nice to just slap a promise on the controller attribute though!

There is no test coverage yet, but I can work on changing that if this seems like a good direction to the main team. All of the existing tests pass.

Thanks for a great project - overall ui-router has felt like a complete and useful abstraction.