Angular
Fundamentals of Angular - Routing

Navigating in Code

Mute
Current Time 0:00
/
Duration Time 0:00
Loaded: 0%
Progress: 0%
Stream TypeLIVE
Remaining Time -0:00
 

In this video...

You will learn about how to navigate to a route from within the code.

Sometimes we need to navigate to a route from within code. Some of the reasons we may need to do this are:

  1. Handling situations where the anchor tag won't work
  2. Routing based on logic in the code. For example, navigating to login first if the user hasn't logged in.

In these cases we need to be able to navigate within our code. This is possible by using the Router service from the RouterModule.

 

I finished! On to the next chapter