I'm writing an application using Aurelia JS. How can I redirect to another URL? Is there a way to do it without creating a whole new navigation pipeline step?
Thanks
to do that inject the router in the ViewModel and use the method navigate(route)
here is an example:
import {Router} from 'aurelia-router'; export class MyVM { static inject() { return [Router]; } constructor(router){ this.router = router; } someMethod(){ this.router.navigate("myroute"); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With