In this post , we will see how to install angular environment and create & run first ever angular application –
You need to install node.js on your system. You can download node.js from their official website https://nodejs.org/en/
Once you install it on your system,you can check the version of node.js by executing below command on command line –
node -v v10.15.0
With node.js installation ,you will by default get npm (Node Package Manager). NPM provides the libraries required to run the angular application. Below command gives the version of npm –
npm -v 6.4.1
Now below are the steps to create,build & deploy your first angular application .
Step 1: Install Angular CLI
Angular CLI is Command Line Interface which provides various commands to create , build and deploy application . Below is npm command to install Angular CLI globally –
npm install -g @angular/cli
Step 2: Create a workspace anf first Anguar application
ng new firstApp
This will create a workspace for new project i.e. first-app . It will generate all the initial artifacts. Project structure is as below –
- src – All source files
- e2e – End to end test project
- Configuration files – angular.json, package.json etc.
Step 3: Use of IDE
I personally prefer, Visual Code Studio as IDE for angular project. Its an open source IDE provided by Microsoft.
Step 4: Build and deploy
This command will build the project and create the artifacts in /dist folder.
This command will deploy the build artifacts to nodejs server and serve it to client.
Application can accessed via – http://localhost:4200/