有没有办法在加载延迟加载模块之前添加解析器?我试图添加resolve
到 routs 配置,但它没有被触发,也没有在网上找到任何有用的东西。任何帮助,将不胜感激
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 { }