Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I recently started implementing lazy loading in my application. I was wondering whether there is any way to create a routing.module.ts while generating a new module in angular-cli application other than creating it manually?

like image 446
Saiyaff Farouk Avatar asked Feb 28 '17 07:02

Saiyaff Farouk


People also ask

Which command will generate an application that includes a routing module?

Run ng generate to create the application routing module. Puts the file in src/app instead of its own directory.


2 Answers

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.

like image 113
Saiyaff Farouk Avatar answered Oct 14 '22 09:10

Saiyaff Farouk


Module with Routing Create CMD :-

ng g m [ModuleName] --routing 
like image 34
Thai Mozhi Kalvi Avatar answered Oct 14 '22 10:10

Thai Mozhi Kalvi