Home  >  Q&A  >  body text

When does angularjs use ui-router to pull data?

Use ui-router for routing. When some pages are entered, data must be obtained from the background.

Should I pull the data in the resolve of the ui-router, or use the service in the controller of the page to pull the data?

What are the advantages and disadvantages of the two methods?

天蓬老师天蓬老师2650 days ago875

reply all(1)I'll reply

  • 三叔

    三叔2017-06-22 11:55:13

    In ui-router, the data is obtained first and then the page is loaded. In the controller, the page is rendered first and then the data is obtained.
    When your ui-router request times out or errors, this page will not be displayed, giving people an abrupt feeling.
    You can operate the data in the controller, which is better. This is how I understand it.

    Flash~ (●'◡'●)ノ♥

    reply
    0
  • Cancelreply