全部角度參數路由
我開發了一個新的輔助站點。 http://auxiliary-site?ownerId=some-guid
我做AppRoutingModule:用戶會從主站點使用的參考像被引用到這個網站
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AppComponent } from './app.component';
import { ConfigurationsComponent } from './configurations/configurations.component';
import { CreateConfigurationComponent } from './create-configuration/create-configuration.component';
import { PageNotFoundComponent } from './pageNotFound/pageNotFound.component';
const routes: Routes = [
{ path: ':ownerId', redirectTo: 'new-configuration/:ownerId', pathMatch: 'full' },
{ path: 'configurations/:ownerId', component: ConfigurationsComponent },
{ path: 'new-configuration/:ownerId', component: CreateConfigurationComponent },
{ path: '**', component: PageNotFoundComponent }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
我引用這個模塊的AppModule:
@NgModule({
imports: [BrowserModule, FormsModule, HttpModule, AppRoutingModule, PaginationModule.forRoot(), ModalModule.forRoot()],
declarations: [AppComponent, ConfigurationsComponent, CreateConfigurationComponent, PageNotFoundComponent],
bootstrap: [AppComponent],
providers: [ConfigurationsService, CreateConfigurationService, ImageMapper]
})
export class AppModule { }
但比我啓動我的應用程序並去http://localhost:3000?ownerId=some-guid或http://localhost:3000/new-configuration?ownerId=some-guid我抓到:404頁未找到。
我能做些什麼來解決這個錯誤?