クエリパラメータを渡したいですprop=xxx
。
これはうまくいかなかった
<a [routerLink]="['/somepath', {queryParams: {prop: 'xxx'}}]">
Somewhere
</a>
ベストアンサー1
queryParams
queryParams
routerLink
渡すことができる別の入力です
<a [routerLink]="['../']" [queryParams]="{prop: 'xxx'}">Somewhere</a>
fragment
<a [routerLink]="['../']" [queryParams]="{prop: 'xxx'}" [fragment]="yyy">Somewhere</a>
routerLinkActiveOptions
親ルートに設定されているルートのアクティブ クラスも取得するには:
[routerLinkActiveOptions]="{ exact: false }"
this.router.navigate(...)
使用するクエリパラメータを渡すには
let navigationExtras: NavigationExtras = {
queryParams: { 'session_id': sessionId },
fragment: 'anchor'
};
// Navigate to the login page with extras
this.router.navigate(['/login'], navigationExtras);