christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

Lazy load future state #211

Open Bessonov opened 9 years ago

Bessonov commented 9 years ago

Hello Chris,

it is possible to load states lazy? I mean, for example, invoke resolveFunctions only if requested state (or none states match the url) is not found?

BTW, wheere I can find more info about ui-router 1.0, mentioned in #190?

Thanks in advance

Anton

christopherthielen commented 9 years ago

Future states is all about lazy loading states, so I guess I'm not sure how to interpret your question.

ui-router 1.0 preview: https://github.com/angular-ui/ui-router/tree/feature-1.0

Bessonov commented 9 years ago

Thanks for the link, @christopherthielen !

May be I use it wrong. I created a plunker from ui-router plunker and add resolve from future example. There is no missing state, but the function is invoked and the alert is shown.

My use case is loading states, if user type not-existing-yet url. I request server (expensive!) to check user permissions and get back, which files (containing states and controllers) should be loaded. Then I load them through ocLazyLoad and everything works. But my problem, that server is requested on first load and not if necessary.