Angular 6路由URL在地址栏中追加双路由值

时间:2018-10-02 16:39:21

标签: asp.net angular angular6

投射基本网址:

<base href="/collateral/edit/" />

工作网址: http://localhost/collateral/edit/9

当我导航到不再存在的项目ID时,我的URL在浏览器中更新为: http://localhost/collateral/edit/Collateral/Edit/5

有人知道为什么我的网址后面会附加“ / Collat​​eral / Edit / ”吗?

collat​​eral-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 { }

0 个答案:

没有答案