JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!

Routing in Angular 2 Revisited

  • Again, we don’t want to worry too much about how this component is implemented yet, but a simplified version could look something like this:

    Especially in there are a couple more things we need to consider when it comes to routing (e.g. how to link to that component, how to get access to URL parameters), but for now, the first thing we want to do is defining routes for our application.

  • The next thing we want to do is to make sure that the component we route to, is also displayed in our application.
  • With the new router, there are different ways to route to other components and routes.
  • Taking a look at our template, we see that we’re iterating over a list of contacts:

    We need a way to evaluate something like to generate a link in our template.

  • We still need to teach how to access the route parameters so it can use them to load a contact object.

Routing in Angular revisited by thoughtram