无法匹配任何路线:angular rc5

时间:2016-09-19 06:33:10

标签: angular angular2-routing

从当前模块中点击其获取步骤1 / personinvolved的链接。我希望它直接导航yo / personinvolved。

我在第1步中使用了routerLink =“personinvolved”。而step1和personinvolved有不同的路由器,并在app.module中导入。

如何避免在网址中使用step1。请建议

step1当前页面链接在

之下
<a href="javascript:" routerLink = "personinvolved" title="Can you describe the vehicles involved?" class="person-involved-vehicle-involved">Can you describe the vehicles involved?</a>

人员模块如下。

import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';

import { personRouting } from './person.routing';
import { PersonInvolvedComponent } from './personinvolved.component';

@NgModule({
    imports: [
        FormsModule,
        CommonModule,
        personRouting
    ],
    declarations: [
        PersonInvolvedComponent
    ]
})

export class PersonModule {

}

人员路由在

之下
import { ModuleWithProviders }  from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { PersonInvolvedComponent }    from './personinvolved.component';

const personRoutes: Routes = [
  { path: 'personinvolved',  component: PersonInvolvedComponent }
];
export const personRouting: ModuleWithProviders =     RouterModule.forChild(personRoutes);

app模块位于

之下
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { HttpModule } from '@angular/http';
import { HTTP_PROVIDERS } from '@angular/http';
import { AppComponent }  from './app.component';
import { routing, appRoutingProviders } from './app.routing';

import { HomeModule } from './modules/home/home.module';
import { Step1Module } from './modules/step1/step1.module';
import { PersonModule } from './modules/person/person.module';

import { GlobalService } from './services/global.service';

@NgModule({
  imports:      [ 
     BrowserModule,
     HttpModule, 
     routing, 
     HomeModule,
     Step1Module,
     PersonModule
  ],
  declarations: [ 
    AppComponent
   ],
  providers: [ GlobalService, HTTP_PROVIDERS ],
  bootstrap: [ AppComponent ]
})

export class AppModule { }

0 个答案:

没有答案