is there a way to add a resolver before loading a lazy load module? i tried to add resolve
to the routs configuration but it is not triggered, also didn't find any thing useful about it on the web. any help would be appreciated
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
// services
import {SecondResolverService} from "./second.resolver.service";
const routes: Routes = [
{ path: 'first' , loadChildren: './first/first.module#FirstModule' },
{ path: 'second', loadChildren: './second/second.module#SecondModule' ,resolve : {data : SecondResolverService}}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Angular docs on lazy loading
This config always works for me. If this doesnt work there may be something wrong with your resolver.