Angular cli is a useful toolset which helps in development,testing and deployment of Angular applications.
Check if cli is installed
ng --version
Install latest version of angular cli
npm install -g @angular/cli@latest
Create new Angular project using cli
1.Create folder where you want to create Angular application
2.Open command prompt and navigate to the above folder
3.Type following command
ng new angular-app-name --dry-run
this command will show you the files which it will create without creating the files.It does thin in-memory.This is a good way to verify
if the command will produce the files which you are expecting it to produce.
ng new angular-app-name
4.Veify if it is working fine type
ng serve
this should open the application in browser
5.Type following command to open the application in visual studio code
code ..
the above command will open the new angular application in visual studio code
Generate project elements
component
ng generate component component-name
module
ng generate module module-name
directive
ng generate directive directive-name
Leave a Reply