Angular Go to Route
import {Router} from '@angular/router';
constructor(private router: Router) {}
navigateToLogin() {
this.router.navigateByUrl('/login');
}
Ham-Solo
import {Router} from '@angular/router';
constructor(private router: Router) {}
navigateToLogin() {
this.router.navigateByUrl('/login');
}
ng g m [ModuleName] --routing
import {Router} from '@angular/router'; // import router from angular router
export class Component{ // Example component..
constructor(private route:Router){}
go(){
this.route.navigate(['/page']); // navigate to other page
}
}
// Here’s a basic example using the navigate method:
goPlaces() {
this.router.navigate(['/', 'page-name']);
}
/*
I hope it will help you.
Namaste
*/