Is there a way to make a component route wait for data before executing the controller and rendering the view, similar to using resolve
in ngRoute
or ui-router
?
The documentation provides an example:
https://i.sstatic.net/Do1Qa.png
This only waits for the URL change, as shown below:
//Old url
http://localhost/#/
// wait for the promise (e.g. 1s) and then change the url to
http://localhost/#/heroes
However, the view is changed immediately after clicking the link, followed by the URL change, which seems odd!
This process does not block the view render or controller execution (obviously).
Here's a demo of this situation:
Code and preview: plunkr.co (click on heroes)
There is a similar unanswered question here: Angular 1.5.x Component Router Resolve