In AngularJS I used ui-router for redirecting inside of my app(changing state).
It has 2 possible options to redirect
ui-sref='stateName'
$state.go()
I just start play with Angular (4) and I found only way how to change route from template with something like:
routerLink="routePath"
Is there some way as there was in ui-router to change route from component?
constructor(private router:Router) {}
changeRoute() {
this.router.navigate(...)
// this.router.navigateByUrl(...)
}
See also https://angular.io/docs/ts/latest/api/router/index/Router-class.html
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