0

I have a page that call two component through selector:

<app-category-list>
<article-view></article-view>

In order to gathering datas for article-view I use a resolve attached to the route.module in this way:

 {path: 'article-view/:id', component: ArticleViewComponent , resolve: { article: ArticleDataResolver }, data: {title: 'View Article'}},

this resolve call a service with a promise inside that does a API request.

I retrive the data for my category using an APP_Initializer that return a promise in order to have this data when the application is initialized.

Everything is working and the component category received its data.

PROBLEM

The component category wait to render the category page until the revolse end its promise and return its data.

Is that a problem cos the two component are called in the same page as childs?

  • This is the normal behaviour of router. What ever you put in router resolve. Before loading the component. router will complete all the resolve items. You should show a loader when router is resolving I think. [refer here](https://stackoverflow.com/questions/37069609/show-loading-screen-when-navigating-between-routes-in-angular-2) – JsNgian Aug 24 '21 at 12:23
  • So basically one component using a resolve block all the others components that are loading on a parent page? – madenGlitch Aug 24 '21 at 12:55
  • what ever you load in will not be there – JsNgian Aug 24 '21 at 13:14
  • the category is located outside the – madenGlitch Aug 24 '21 at 13:59

0 Answers0