NavigationExtras
用于修订导航策略的额外选项。
Options that modify the navigation strategy.
interface NavigationExtras {
relativeTo?: ActivatedRoute | null
queryParams?: Params | null
fragment?: string
preserveQueryParams?: boolean
queryParamsHandling?: QueryParamsHandling | null
preserveFragment?: boolean
skipLocationChange?: boolean
replaceUrl?: boolean
state?: {...}
}
属性
属性 | 说明 |
---|---|
relativeTo?: ActivatedRoute | null | 允许从当前激活的路由进行相对导航。 Specifies a root URI to use for relative navigation. 比如,考虑下列路由器配置,parent 路由拥有两个子路由。 For example, consider the following route configuration where the parent route has two children.
The following
|
queryParams?: Params | null | 设置 URL 的查询参数。 Sets query parameters to the URL.
|
fragment?: string | 设置 URL 的哈希片段( Sets the hash fragment for the URL.
|
preserveQueryParams?: boolean | 已废弃,请改用 DEPRECATED: Use |
queryParamsHandling?: QueryParamsHandling | null | How to handle query parameters in the router link for the next navigation. One of:
|
preserveFragment?: boolean | 在后续导航时保留 When true, preserves the URL fragment for the next navigation
|
skipLocationChange?: boolean | 导航时不要把新状态记入历史 When true, navigates without pushing a new state into history.
|
replaceUrl?: boolean | 导航时不要把当前状态记入历史 When true, navigates while replacing the current state in history.
|
state?: { [k: string]: any; } | Developer-defined state that can be passed to any navigation. Access this value through the After a navigation completes, the router writes an object containing this value together with a Note that |