mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Prior to this change in some cases errors tht happen during routing were not being surfaced. This is due to the fact that the router has floating promises, and the platform was being destroyed prior to these being settled. PR Close #50587
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import {NgModule} from '@angular/core';
|
|
import {RouterModule, Routes} from '@angular/router';
|
|
import {HelloWorldComponent} from './helloworld/hello-world.component';
|
|
import {TransferStateComponent} from './transferstate/transfer-state.component';
|
|
|
|
const routes: Routes = [
|
|
{
|
|
path: 'helloworld',
|
|
component: HelloWorldComponent,
|
|
},
|
|
{
|
|
path: 'transferstate',
|
|
component: TransferStateComponent,
|
|
},
|
|
{
|
|
path: 'http-transferstate-lazy',
|
|
loadChildren: () =>
|
|
import('./http-transferstate-lazy/http-transfer-state.module').then(
|
|
(m) => m.HttpTransferStateModule
|
|
),
|
|
},
|
|
{
|
|
path: 'http-transferstate-lazy-on-init',
|
|
loadChildren: () =>
|
|
import('./http-transferstate-lazy-on-init/http-transferstate-lazy-on-init.module').then(
|
|
(m) => m.HttpTransferStateOnInitModule
|
|
),
|
|
},
|
|
{
|
|
path: 'error',
|
|
component: HelloWorldComponent,
|
|
resolve: {
|
|
'id': () => {
|
|
throw new Error('Error in resolver.');
|
|
},
|
|
},
|
|
},
|
|
];
|
|
|
|
@NgModule({
|
|
imports: [RouterModule.forRoot(routes)],
|
|
exports: [RouterModule],
|
|
})
|
|
export class AppRoutingModule {}
|