How to setup Routing in Angular

     

When adding routes in angular, we can separate the routing code into its own file. We can add a new module call app-routing.module.ts. Use the angular cli to add a new module. Type “ng g m app-routing” This will generate a new module.

Add the following code:

in the above code, we can add children to each path. Each child can do separate things such as edit and new functions.

comments powered by Disqus