Using Anular CLI, how do you create a new component that will be automatically imported to your main app module?

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

By executing the above commnd you are telling Angular CLI to create a component name-of-your-component and to include it in the application module app (as the parameter --module wasn't provided, the default value 'app' will be used).

  • The component will be created in its own folder src/app/name-of-your-component
  • The module file src/app/app.module.ts will be modified as the component will be imported into it

Comments

No Comments Yet.
Be the first to tell us what you think.
Angular CLI for beginners
Angular CLI for beginners

Are you learning Angular CLI ? Try our test we designed to help you progress faster.

Test yourself

Chat

Oh, the operator is not available. Leave us your comments. We will answer all your questions as soon as possible.

Comments

Anonymous
Καλησπέρα.
Anonymous
the infinteis -3/15 so 1triition / infinet
Anonymous
e
Anonymous
<a href="https://inspirum.pl "
Anonymous
[url]https://inspirum.pl[/url]
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e
LaceJaguar65
e