、次のコードエラー:どのルートにも一致することはできません。 URLセグメント:私はちょうど角度にルータを学び始め、私は名前のコンセントを使用することができません「ホーム」
const routes: Routes = [{
path: "about",
component : AboutComponent,
children : [{
path : "contact",
component: ContactComponent }, {
path : "message",
component: MessageComponent }, {
path : "",
component: ContactComponent },
]},
{
path: "home",
component : HomeComponent
// outlet : "main" When I add this, it is not working
},{
path: "",
component : HomeComponent,
outlet : "main"
}];
app.component.html
------------------
<h1>The Header</h1>
<a routerLink="home">Home</a>
<a routerLink="about">About</a>
<router-outlet></router-outlet>
<router-outlet name="main"></router-outlet>
<h1>The footer</h1>
をご覧ください上記のコードは正常に動作しますが、私はにコンセントを追加するときpath:'home'
、それは Error: Cannot match any routes. URL Segment: 'home'
と言います。
アウトレット名を指定する必要があります。「角度ルーティング」:https://app.pluralsight.com/library/courses/角度ルーティング/目次ここでは、さまざまなタイプのルーティングについて説明します。無料で1週間申し込むことができます。 – DeborahK