Prerequisites
For developing an angular application you just have to include Node.js and npm package manager.
To get Node.js, just visit nodejs.org, download the setup and install in your machine.
npm package manager
There is plenty of libraries and angular uses all these libraries with is available in the npm packages . We must have npm package manager to download and install npm packages.
npm is installed with Node.js by default. So no need to install separately
To check that you have the npm client installed, run npm -v
in a terminal/console window.
Step 1: Install the Angular CLI
You use the Angular CLI to create projects, generate application and library code, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.
First we have to install the Angular CLI globally.
To install the CLI using npm
, open a terminal/console window and enter the following command:
npm install -g @angular/cli
Step 2: Create your first application
To create you first application you have run CLI command follow as below.
ng new my-app
Here my-app is my application name. We can give any name instead of my-app. Just press enter after typing the above command and your first application is created.
Just download the visual studio code as an editor and open your newly created project in this editor.
Step 3: How to run the Angular application
Just run the command in the terminal and press enter, browser will open with default tab with URL http://localhost:4200/
and you see the output of you application.
ng serve --open
You can also use –o instead of –open