You are tasked with implementing a feature where, upon clicking a button, the user should be redirected to the home page. Which method or feature of Angular's router would you utilize?

  • router.navigate(['/home']);
  • router.navigate(['home']);
  • router.navigateByUrl('/home');
  • router.to(['/home']);
To redirect the user to the home page using Angular's router, you should use the router.navigate(['/home']); method. This method navigates to the specified route, in this case, '/home', which represents the home page. The other options are either incorrect or do not exist in Angular's routing syntax.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *