我不明白为什么我的应用程序不能在Firefox上运行而在Chrome上运行。
使用loadChildren
删除import()
的工作原理...
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {LayoutComponent} from './layout/layout.component';
const appRoutes: Routes = [
{
path: '', component: LayoutComponent,
children: [
{path: '', redirectTo: 'components', pathMatch: 'full'},
{
path: 'components',
loadChildren: () => import('./pages/component-creator/component-creator.module').then(m => m.ComponentCreatorModule)
},
{
path: 'templates',
loadChildren: () => import('./pages/template-creator/template-creator.module').then(m => m.TemplateCreatorModule)
},
]
},
// Not found
{path: '**', redirectTo: 'components'},
];
@NgModule({
imports: [RouterModule.forRoot(appRoutes, {
enableTracing: false, // tracing for debug
onSameUrlNavigation: 'reload',
})],
exports: [RouterModule]
})
export class AppRoutingModule {
}
注意:<base href="/">
有什么想法吗?
谢谢!