2

I have an angular hybrid app (angularjs with angular) with lazy loading on one of the feature modules.

The feature module is declared the following way

const contactFs: NgHybridStateDeclaration = {
    name: 'contact.v2.**',
    url: '/contact/v2/',
    loadChildren: () =>
        import(/* webpackChunkName: "contactM" */ './contacts.module').then(m => m.contactsModule)
};

I have the following states declared in the contacts module

export const state1: Ng2StateDeclaration = {
    name: 'contact.v2',
    url: '/'
};

export const state2: Ng2StateDeclaration = {
    name: 'contact.v2.details',
    url: ':id/details',
    component: detailsComponent,
};

Now I can navigate to the contact.v2.details state without a problem from the home component. The url becomes something like host/contact/v2/9ee34d65-a91f-460c-9947-e2a7ee9d5538/details

The problem is that when the user clicks the refresh on the browser, it does not load the component, it just loads an empty state. Not sure what is going wrong here, it seems like it is not loading the lazy loaded module at all when hitting the refresh button.

pandith padaya
  • 1,643
  • 1
  • 10
  • 20

2 Answers2

0

Change in your index.html as below.

<base href='./'>

surendra kumar
  • 1,686
  • 11
  • 15
0

the problem is when you refresh you don't have the data (in your first call you pass the data to the detail components but when you refresh the data are not in it) you need to use rxjs and do the call on the onInit method (i say this because i am writing same project as you using drupal 8.9)

Marco Bertelli
  • 343
  • 1
  • 9