angular2 でプロジェクトを開始しましたが、何らかの理由でルートにコンポーネントが 2 回表示されます。関連するコード スニペットを次に示します。
app.routing.ts
// Some import
import { AuthComponent } from './master/auth';
const appRoutes: Routes = [
{
path: 'master/registration',
component: AuthComponent
}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
app.module.ts
import { AuthComponent } from './master/auth/auth.component';
import { AppComponent } from './app.component';
import { routing } from './app.routing';
@NgModule({
declarations: [
// components
AuthComponent
],
providers: [
// some providers
],
imports: [
BrowserModule,
ReactiveFormsModule,
routing
],
bootstrap: [AppComponent]
})
export class AppModule {}
app.component.htmlが含まれています<app-auth></app-auth>
auth.component.ts
import { Component, OnInit } from '@angular/core';
import * as all from './auth-utils';
@Component({
moduleId: module.id,
selector: 'app-auth',
templateUrl: 'auth.component.html',
styleUrls: ['auth.component.css']
})
export class AuthComponent implements OnInit {
constructor() {}
ngOnInit() {
}
}
auth.component.html
<app-register-form [fields]="fields"></app-register-form>
<app-login-form [loginFields]="loginFields"></app-login-form>
<router-outlet></router-outlet>
ここで何が欠けていますか?