I agree with most of this -- ng-controller should be considered harmful. Though I don't necessarily agree with dropping ui-router's resolve. Resolve prevents the flickering. Controllers shouldn't deal with loading indicators -- that should be an application-level service. Nested states are awesome -- ng-route is not a worthy substitute for this reason in many cases. And you can use $state.$current.locals in your directives... so there's that.
I dislike ng-route and always prefer ui-router. I just don't usually use resolve - you should have some generic handler for flickering but a lot of times if you're going for really smooth UI and transitions you can't just use some generic loader that hides everything between every transition.
omg I can't believe I didn't know about $state.$current.locals though. I actually searched the ui-router docs specifically when writing the post to make sure and just couldn't find that. Thanks a bunch!
omg I can't believe I didn't know about $state.$current.locals though. I actually searched the ui-router docs specifically when writing the post to make sure and just couldn't find that.
that's because it's internal (the $dollar) and not part of the public API. It's gone in ui-router 1.0.
3
u/[deleted] Oct 07 '15
I agree with most of this --
ng-controllershould be considered harmful. Though I don't necessarily agree with dropping ui-router's resolve. Resolve prevents the flickering. Controllers shouldn't deal with loading indicators -- that should be an application-level service. Nested states are awesome --ng-routeis not a worthy substitute for this reason in many cases. And you can use$state.$current.localsin your directives... so there's that.