UrlCreationOptions
本选项用来修改 Router
的 URL。向 Router
导航功能提供包含任何这些属性的对象,以控制应如何构造目标 URL。
Options that modify the Router
URL. Supply an object containing any of these properties to a Router
navigation function to control how the target URL should be constructed.
interface UrlCreationOptions {
relativeTo?: ActivatedRoute | null
queryParams?: Params | null
fragment?: string
queryParamsHandling?: QueryParamsHandling | null
preserveFragment?: boolean
}
子接口
参见
属性
属性 | 说明 |
---|---|
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
A value of |
queryParams?: Params | null | 设置 URL 的查询参数。 Sets query parameters to the URL.
|
fragment?: string | 设置 URL 的哈希片段( Sets the hash fragment for the URL.
|
queryParamsHandling?: QueryParamsHandling | null | 如何在路由器链接中处理查询参数以进行下一个导航。为下列值之一: How to handle query parameters in the router link for the next navigation. One of:
“preserve” 选项将放弃所有新的查询参数: The "preserve" option discards any new query params:
“merge” 选项会将新的查询参数附加到当前 URL 的参数中: The "merge" option appends new query params to the params from the current URL:
In case of a key collision between current parameters and those in the |
preserveFragment?: boolean | 在后续导航时保留 When true, preserves the URL fragment for the next navigation
|