Using Anular CLI, how do you create a new component that will be automatically imported to your feature module that is called feature-module1?
Experience Level: Junior
Tags: AngularAngular CLI
Answer
A component can be created by running the following command from the command line:
ng generate component name-of-your-component --module feature-module1
By executing the above commnd you are telling Angular CLI to create a component name-of-your-component and to include it in the feature module feature-module1.
- The component will be created in its own folder src/app/name-of-your-component
- The module file src/app/feature-module1/feature-module1.module.ts will be modified as the component will be imported into it
Related Angular CLI job interview questions
How do you build your Angular application using Angular CLI for use on production environment?
AngularAngular CLI JuniorHow do you build your Angular application using Angular CLI for use on a local or development environment?
AngularAngular CLI JuniorUsing Anular CLI, how do you create a new component that will be automatically imported to your main app module?
AngularAngular CLI JuniorUsing Anular CLI, how do you create a new feature module that will be automatically imported to your main app module?
AngularAngular CLI JuniorHow do you create new application using Angular CLI?
AngularAngular CLI Junior