angular cli tutorial code example

Example 1: setup new angular project

/*
Setting up new angular project and run on browser
*/
npm install -g @angular/cli
ng new project-name
cd project-name
ng serve

/*
I hope it will help you.
Namaste
*/

Example 2: install angular cli

npm install -g @angular/cli    //make sure you have node/npm installed 
ng new         //  eg:  ng new my-app
cd        // cd my-app
ng serve

Example 3: create angular project cli version 8

#Angular 2:the last RC version before switching to angular 4 as far as I can tell — based on this and the next version now depends on angular
npm install @angular/[email protected] 
ng new angular2app

#Angular 4: the last CLI version before angular 5
npm install @angular/[email protected] 
ng new angular4app

#Angular 5: the last CLI version before 6
npm install @angular/[email protected] 
ng new angular5app

#Angular 6: the last CLI version before 7
npm install @angular/[email protected] 
ng new angular6app 

# Angular 7: (the last CLI version before 8
npm install @angular/[email protected] 
ng new angular8app 

#Angular 8: the last CLI version before 9
npm install @angular/[email protected] 
ng new angular8app 

#Angular 9: not last CLI version 9 
npm install @angular/[email protected] 
ng new Angular9App

Example 4: angular start command

http-server -a localhost -p 8000 -c-1 .

Tags:

Misc Example