Skip to content

ui-router-navigation-location-plugin / NavigationLocationPluginOptions

Interface: NavigationLocationPluginOptions ​

Defined in: index.ts:66

Options for navigationLocationPlugin.

Properties ​

PropertyTypeDescriptionDefined in
intercept?(event) => NavigationInterceptOptionsCalled for each navigation the service itself starts, after the router transition has committed. What it returns is handed to event.intercept(): handler decides what navigation.transition.finished waits on and when the browser runs focus reset and scroll restoration, and focusReset and scroll pass through. The router is available as event.info.uiRouter. focusReset defaults to 'manual', so focus stays where it was, as under pushStateLocationPlugin. Return focusReset: 'after-transition' to have the browser move focus to <body> after each navigation instead. Absent, the service intercepts with an immediately resolving handler. Example router.plugin(navigationLocationPlugin, { intercept: (event) => ({ async handler() { // view transitions, analytics, progress UI }, }), } satisfies NavigationLocationPluginOptions);index.ts:93
interceptTraverse?true | ((event) => NavigationInterceptOptions)Intercepts back/forward traversals of this document, so the browser restores scroll, and resets focus if asked to, once the router transition the traversal starts has settled. Absent, the service leaves traversals alone and the browser restores their scroll position straight away, before the router transition the traversal starts has run. Passed, the service intercepts each traverse navigation it can intercept, other than one this plugin started itself, with a handler that waits for that router transition, including its redirects, to settle. A superseding navigation ends the wait. Pass true for the defaults, or a function whose return value is handed to event.intercept(). The function runs at navigate time, before the router transition exists, so unlike intercept it cannot read the destination state's data. Its handler runs after the router transition settles, and the service forces a layout once it settles, so the browser restores scroll against the rendered view. focusReset and scroll pass through; focusReset defaults to 'manual', as for intercept. Example router.plugin(navigationLocationPlugin, { interceptTraverse: (event) => ({ async handler() { // the destination view has rendered }, }), } satisfies NavigationLocationPluginOptions);index.ts:127