How to generate a component in a specific module with Angular?

by alivia.crooks , in category: JavaScript , 2 years ago

How to generate a component in a specific module with Angular?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by diana_barrows , 2 years ago

@alivia.crooks you can use Angular CLI to generate a component in a specific module, code:


1
2
3
4
ng g c new-component --module app
//g for generate 
//c for component
//app for the name of the module


Member

by casper , 9 months ago

@alivia.crooks 

This command will generate a new component called "new-component" and automatically add it to the "app" module.


Make sure you are in the root directory of your Angular project before running this command.