Skip to main content

Command Palette

Search for a command to run...

Angular Newbies V

Angular Command Line Interface

Published
β€’2 min readβ€’View as Markdown
Angular Newbies V
M

πŸ‘‹πŸ½ Hello My Name is Mohamud Abshir from Mogadishu - Somalia πŸ‡ΈπŸ‡΄

πŸŽ“ Graduated Jamhuriya University of Science and Technology - BSc in Electrical Electronics and Telecommunication Engineering πŸ“‘ (August - 2018)

πŸ§‘πŸΌβ€πŸ’» Professional Front-End developer with 1 Years of experience, in developing web Applications using Angular and , UI/UX Designer

🏒 Employed as Head of ICT and Front-End Developer, Managing Director & Co-founder at Deero Advertising agency, Employed as Web Developer @SIMAD iLab, Employed as Tech Consultant @SITCO in Mogadishu - Somalia

πŸ” i like coding and i start coding when i was in the university, also in my free time i also like to teach coding and design and i do teach students how to code locally

πŸ’ͺ🏽 HTML5 , CSS3, Bootstrab, SASS, Tailwind, javaScript, ReactJs, React Native, flutter, Git, GitHub, NodeJs ....

Angular CLI

What is Angular CLI ?

The Angular CLI is tool that angular developers use to make it easy to create an Angular application that works and follows best practices right out of the box.

don't worry i'll make a series about the angular CLI, angular CLI helps to create every piece of angular application with one line like component, services, pipes, and so on.

Today's post is all about Creating Angular Components using Angular CLI.

as i mentioned in the first post you have to install Angular CLI on your computer to use it , if you don't have Angular CLI you can install

npm install -g @angular/cli

this line of command will install angular CLI globally on your machine.

now let's go and make a fun of Angular CLI To create a new component go the folder of your angular application and type this command

ng generate component ComponentName

Walaaaah ! that is it you just generated new component so let's explain what that line of code did first of all it will generate 4 files

  • the template (.html) file

  • the style (.css) file

  • the component (.ts) file

  • the test file

Also did register our component in the angular Module so we can use it's selector across our application easy isn't it !

so there are some flags you can add when generating new component using angular CLI , we'll learn the for the up comming series

so let's see these two flags

  1. --skip-tests

  2. -dry-run

these two commands tell angular CLI to do some thing extra

ng generate component componentName --skip-tests

it will skip the test file on the new component as we saw above the 4 files angular generats one of the was test file it will not generate a test file each time you use this flag

ng generate component componentName -dry-run

this flag it shows you what this command do in the disk it will not create anything on your folder it will just show you the before -dry-run command what that command will do,

it just reports you what will happen and it will not create a single file on your disk

general use case of this command is when you are not sure what this command will do just test it with -dry-run and it will report you what would happen if this command is executed

don't worry if you did not understand clearly will talk about this commands in a separate topics

i hope you found some thing useful here thanks for you reading

Angular For Newbies

Part 1 of 5

This is a beginner friendly series aimed to help new beginners to learn and adapt quickly angular framework,

Up next

Angular Newbies IV

Introduction to Angular Components