2017-09-21 5 views
0

すべてパラメータがangle4のルート

私は新しい補助サイトを開発しました。私はAppRoutingModuleを作っhttp://auxiliary-site?ownerId=some-guid

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ページが見つかりません。

このエラーを修正するにはどうすればよいですか?

答えて

0

、URLの書き込みの方法は、その場合には、この

http://localhost:3000/some-guid 
http://localhost:3000/new-configuration/some-guid 

のようなクエリパラメータを追加する必要もないでしょう。

関連する問題