Angular ui-router: How to allow parent view before resolving child?

Consider the following ui-router setup:

index.html

<div ui-view></div> 

ui-router configuration

 $stateProvider .state('search', { abstract: true, url: '/search', views: { '@': { templateUrl: 'main.html' } } }) .state('search.results', { url: '/results', views: { ... }, resolve: { data: function() { ... } } }) 

When I go to search.results , main.html not displayed until resolve is resolved.

Is there a way in ui-router to display the parent view before the child resolve ?

Another related question

+5
source share
1 answer

As mentioned in the commentary, the purpose of using permission is to prevent state changes before loading data. Obviously, you do not want this behavior because you want to enter a state and display part of the view before loading the β€œdata”. The solution is to load the "data" into the controller instead of using permission. If the controller has logic that is dependent on "data", just move that logic to the callback.

+4
source

Source: https://habr.com/ru/post/1200295/


All Articles