子ルートの内部のAUXルートは、動作させるための設定方法がわかりません。 私の好きなルート・コンポーネントとルート設定ファイルを持っている:のようなルートの設定ファイルでFirstComponentとSecondComponentを持って角度2の新しいルータrc4の子のAUXルートが機能しない
root.routes.ts
export const rootRoute:RouterConfig=[
...ChildrenRoute,
{path:'',component:ChildrenRootComponent},
{path:'children-root',component:ChildrenRootComponent},
{path:'other',component:OtherComponent'}
];
template:
'<a routerLink='children-root'>Children root</a>
<a routerLink='other'>Other</a>
<router-outlet></router-outlet>'
とChildrenRootComponent:今すぐ子供ルートからのルート
children.routes.ts
export const ChildrenRoute:RouterConfig=[
{path:"",redirectTo:'/children-root',pathMatch:'full'},
{path:'children-root',component:ChildrenRootComponent,
children:[
{path:'',component:FirstComponent},
{path:'first',component:FirstComponent},
{path:'second',component:SecondComponent,outlet:'aux'}
]
}
];
template:
' <a routerLink='first'>First</a>
<router-outlet></router-outlet>
<a routerLink='aux:second'>Second</a>
<router-outlet name="aux"></router-outlet>'
- 、>セカンドはokですルート子ルート - >最初は動作しません表示エラー:
Error: Cannot match any routes: 'children-root/second'
変更テンプレート:
' <a routerLink='first'>First</a>
<router-outlet></router-outlet>
<a routerLink='(aux:second)'>Second</a>
<router-outlet name="aux"></router-outlet>'
があまりにも動作しません。エラー:エラーメッセージで、ここで「)」
Error: Cannot match any routes: 'children-root/second)'
注意を払う、と
localhost:4200/children-root/(aux:second)
リロードブラウザで次のようにありません「(」 直接設定されたURLとうまくいくので、私は設定推測します多くのことを検索し、間違ったrouterLinkない、何もこのことについて何かを見つける
にそれが働いて見るであろう。 – PengGang
このhrefはページをリロードしないでください。私のアプリではリースで私はHashLocationStrategyを使用していますが、これに似たURLがページをリロードしません: '' 'Second' '' –
これはまだRC.5での問題です..いつこれが解決するかもしれないのでしょうか –