Angular is Javascript based framework to develop frontend web application.To set up Angular2 environment in our system we need to install nodejs and npm.
Checking NodeJs on your machine
To check if node and npm are installed , run the below command in the command line:
node -v
// Output : v8.9.1
npm -v
// Output : 5.7.1
If the above command does not give you any output you have to install nodejs
Installing Angular
To install Angular we will install Angular CLI(Angular Command Line interface), used to create project, add files , deployment and many other things
npm install -g @angular/cli
Create new project
Open the terminal window and browse to the directory where you want to set up the project and run the command below:
ng new myapp
It will install the necessary npm packages,create the project files and set up default app.
Run the application
Once everything is done you can run the application using the command
cd myapp // switch to the application
ng serve –open
ng serve – will start the local dev server and build the application
–open – will launch the application in the browser with url http://localhost:4200