填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

Navigation

有关导航操作的信息。使用 Router.getCurrentNavigation() 方法检索最新的导航对象。

Information about a navigation operation. Retrieve the most recent navigation object with the Router.getCurrentNavigation() method .

查看"说明"...

      
      type Navigation = {
    id: number;
    initialUrl: string | UrlTree;
    extractedUrl: UrlTree;
    finalUrl?: UrlTree;
    trigger: 'imperative' | 'popstate' | 'hashchange';
    extras: NavigationExtras;
    previousNavigation: Navigation | null;
};
    

说明

  • id :当前导航的唯一标识符。

    id : The unique identifier of the current navigation.

  • initialUrl:在导航前传给 Router#navigateByUrl() 调用的目标 URL。这是路由器解析或对其应用重定向之前的值。

    initialUrl : The target URL passed into the Router#navigateByUrl() call before navigation. This is the value before the router has parsed or applied redirects to it.

  • extractedUrl:使用 UrlSerializer.extract() 解析后的初始目标 URL。

    extractedUrl : The initial target URL after being parsed with UrlSerializer.extract().

  • finalUrl:应用重定向之后提取的 URL。该 URL 可能不会立即可用,因此该属性也可以是 undefined。在 RoutesRecognized 事件触发后进行设置。

    finalUrl : The extracted URL after redirects have been applied. This URL may not be available immediately, therefore this property can be undefined. It is guaranteed to be set after the RoutesRecognized event fires.

  • trigger:表明这次导航是如何触发的。 -- 'imperative'-- 由 router.navigateByUrlrouter.navigate 触发。 -- 'popstate'-- 由 popstate 事件触发。 -- 'hashchange'-- 由 hashchange 事件触发。

    trigger : Identifies how this navigation was triggered. -- 'imperative'--Triggered by router.navigateByUrl or router.navigate. -- 'popstate'--Triggered by a popstate event. -- 'hashchange'--Triggered by a hashchange event.

  • extras:一个 NavigationExtras 选项对象,它控制用于此导航的策略。

    extras : A NavigationExtras options object that controlled the strategy used for this navigation.

  • previousNavigation:先前成功的 Navigation 对象。只有一个先前的导航可用,因此该先前的 Navigation 对象自己的 previousNavigation 值为 null

    previousNavigation : The previously successful Navigation object. Only one previous navigation is available, therefore this previous Navigation object has a null value for its own previousNavigation.