Generate a routing module while creating a module in angular-cli Generate a routing module while creating a module in angular-cli angular angular

Generate a routing module while creating a module in angular-cli


I was searching about this a bit and found some article which has a very good explanation for different kind of commands.

The Ultimate Angular CLI Reference

So basically, there's no separate command to create routing.module file. But, that can be created while on the creation of the module

ng g module [module-name] --routing or ng g m [module-name] --routing will create the module and add the mappings/metadata linkings.


Module with Routing Create CMD :-

ng g m [ModuleName] --routing


Creates both module and routing simultaneously in the same folder.

ng g m sub-folder/module-name --routing

Creates the only module.

ng g m  sub-folder/module-name

enter image description here