はこのようにそれを変更してみてください:
<md-toolbar (click)="someAction()"> {{ title }} </md-toolbar>
<router-outlet></router-outlet>
そして、それは、ルーティングされたコンテンツ上の上部に表示されます。
ツールバーがなくてもコンポーネントが必要な場合は、別の中間コンポーネントが必要です。
app.component.html上記ルータコンセントに
<router-outlet></router-outlet>
ルートあなたがなしメニューやツールバーが必要な場合。ツールバーを必要としないすべてのコンテンツのための上記のルータコンセントに
shell.component.html
<md-toolbar (click)="someAction()"> {{ title }} </md-toolbar>
<router-outlet></router-outlet>
ルート。
ルート設定
RouterModule.forRoot([
{
path: '',
component: ShellComponent,
children: [
{ path: 'welcome', component: WelcomeComponent },
{ path: 'x', component: XComponent},
{ path: '', redirectTo: 'welcome', pathMatch: 'full' },
]
},
{ path: 'login', component: LoginComponent }, // <-- no toolbar
{ path: '**', component: PageNotFoundComponent } // <-- no toolbar
])
ありがとう、私はそれをしましたが、私はツールバーを表示する必要があることを忘れていました。 – Polo
その後、ガンターが提案したことをする必要があります。私は彼の言葉の例を含めて私の答えを更新しました。 – DeborahK