navigate()
noun
say it: “NAV-ih-gayt” /ˈnævɪɡeɪt/
The Angular Router method that goes to another route from code.
What is navigate() in Angular?
navigate() — A method on Angular's Router that goes to another route from code, such as after a form is saved or a login succeeds. Pass the path as an array of pieces.
private readonly router = inject(Router);
saved(id: number): void {
this.router.navigate(['/products', id]);
}
In a sentence
- “After saving, router.navigate(['/products', id]) opens the new product's page.”
Level: Apprentice · More Angular terms at this level
Updated