Angular creating components

When you use the command line to create a component, it will be added to the src/app folder.
The following command:

ng g c shoppingList

will create a folder named ‘src/app/shopping-list’, which contains:

shopping-list.component.css
shopping-list.component.html
shopping-list.component.spec.ts
shopping-list.component.ts

Alternatively, if I want to create a folder called ‘shopping’ and inside that have an item called list, I could use this command:

ng g c shopping/list

And that will give this structure:

src
 app
   shopping
     list
       list.component.css
       list.component.html
       list.component.spec.ts
       list.component.ts

What if we don’t want the spec.ts files?

ng g c shopping/list --spec false

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s