Instance
static Instance(mainWindow: Window = window, xssSanitizer: IXssSanitizerService = XssSanitizerService.Instance()): IRouter
Retrieves the router instance.
/* Access the router instance from anywhere */
const router = Router.Instance();
/* Access the router from within a component or page */
const router = this.App.Router;
Route
Route = new Observable<Route>()
Subscribe to route changes via this observable
this.App.Router.Route.Subscribe((route?: Route) => {
console.log(`route changed to ${route?.path}`);
});
CurrentRoute
CurrentRoute?: Route
Access the value of the currently resolved route
UseClientRouting
UseClientRouting(): void
Updates any rendered anchor tags to use client-side routing. Use this only when you have manually added anchor tags to the dom outside of a Fyord component's normal render method.
RouteTo
RouteTo(href: string, push = true): Route
Programmatically route to the given href via client-side routing. You'll need to route to a page from time to time without the user clicking on an anchor tag. Use this method when that time comes.
/* From within a component or page */
this.App.Router.RouteTo('/docs');