Add a blocker that can prevent navigation away from the current page, for example when there is some unsaved data that would otherwise be discarded.
If the blocker function returns true navigation is blocked. If it returns false navigation will proceed as normal, if not blocked by other blockers.
To later on resume navigation that was blocked, you can call the supplied Transition.retry method.
function to be called before navigation
Create a URL for the given location
the location to create a URL for.
Any state of the location will be ignored.
the URL to the location
Get the current location
Navigate to a new location
path to the location
Optionalquery: Record<string, unknown>query string parameters to append to the URL
navigate - When the location has been changed the EventDispatcher will emit a NavigationEvent
Navigate to a new location or update the current location with new data
By default, it is automatically decided whether to replace the current history entry or push a new one. If no new path is provided, or if it resolves to an unchanged path of the URL (not including the query string or fragment), the current history entry will be updated with the provided location data.
You can also set location.method to push or replace instead.
When pushing a new entry, location.state defaults to null.
When replacing, state will only be changed if a new value is provided.
a new location or parts of the location to replace
navigate - When the location has been changed the EventDispatcher will emit a NavigationEvent
Removes a previously configured blocker.
previously added blocker function
The Navigator service lets you navigate to a new location within the application, or update the current location with new data. A location is defined by a path and optional data.
When navigating to a new location, a new entry will be pushed to the history stack in the browser and the EventDispatcher will emit a NavigationEvent.
New locations can be registered using the RouteRegistry service
Example