投射基本网址:
<base href="/collateral/edit/" />
工作网址: http://localhost/collateral/edit/9
当我导航到不再存在的项目ID时,我的URL在浏览器中更新为: http://localhost/collateral/edit/Collateral/Edit/5
有人知道为什么我的网址后面会附加“ / Collateral / Edit / ”吗?
collateral-edit-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { CollateralEditComponent } from './collateral-edit.component';
import { PageNotFoundComponent } from '../page-not-found/page-not-found.component';
const routes: Routes = [
{ path: ':id', component: CollateralEditComponent },
{ path: '**', component: PageNotFoundComponent },
{
path: '',
redirectTo: 'page-not-found',
pathMatch: 'full'
},
{
path: '**',
redirectTo: 'page-not-found',
pathMatch: 'full'
}
];
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule]
})
export class CollateralEditRoutingModule { }