Getting started with Angular application development

Prerequisites:

Angular is a NodeJS based application. NodeJS is a framework based on Javascript running on server.

  • Install Node JS
  • Verify the installed version of nodeJS
node --version
  • Install NPM
npm install -g npm
  • Verify npm version
npm -version
  • Install Angular globally
npm install -g @angular/cli

Verify the angular version

ng --version

To create a new application, use angular cli command

ng new <Appname>

Substitute the name of the app in place of <Appname>

Answer the few default questions and the app is created

Below is the structure of an angular application

  • For any NodeJS application, package.json represents the dependent packages.
  • All source code is present in src folder

Below is the structure of src folder

  • Angular is composed of components. App component is the root component.
  • Component contains a typescript, html, css
  • Typescript is the superset library of javascript which compiles to javascript.
  • Install the dependent nodejs packages
npm install

Run the application using ng serve command

ng serve

Building the application produces bundled javascript files which get referenced in index.html

Application is hosted in http://localhost:4200