0

I'm working with angular 1.

I want to load some data from server before ui-router bootstrapping all the states.

Is it possible to do so?

Thịnh Phạm
  • 2,528
  • 5
  • 26
  • 39
  • I suggest you look at [ui-router wiki page](https://github.com/angular-ui/ui-router/wiki), but I don't think it is possible – rrd Dec 06 '16 at 08:44
  • ui-router includes the ability to resolve data before it loads the view. RTFM – Mikkel Dec 06 '16 at 09:19

1 Answers1

0

I would say that in this Question: AngularJS - UI-router - How to configure dynamic views and mostly in this answer you can get the answer.

The point is to use a feature of UrlRouterProvider - deferIntercept()

The deferIntercept(defer)

Disables (or enables) deferring location change interception.

If you wish to customize the behavior of syncing the URL (for example, if you wish to defer a transition but maintain the current URL), call this method at configuration time. Then, at run time, call $urlRouter.listen() after you have configured your own $locationChangeSuccess event handler.

Full description including working example is here

Community
  • 1
  • 1
Radim Köhler
  • 122,561
  • 47
  • 239
  • 335