Introduction of Angular JS and Angular
- Angular JS
- Angular
1. Angular JS
AngularJS is a JavaScript framework. It can be added to an HTML page with a <script> tag. it is an open-source front-end web framework mainly maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications.
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"> </script>
2.Angular
Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your apps
The angular release starts at 2.0. It is very fast as compared to AngularJS. It has a modular design, has angular CLI, and is easy to develop.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.css']
})
export class ExampleComponent implements OnInit {
constructor() { }
ngOnInit() { }
}
Now let’s check how to install the angular
This is a step-by-step setup guide to setup Angular.
Step 1: Install Node JS from https://nodejs.org/en/download/. After downloading Node.js, the node package manager should automatically be installed. so check the version with bellow command
$ npm --version
Step 2: Install Angular with npm.
npm install -g @angular/cli
Here we have to use the -g with the command that means it’s a globally install angular CLI.
Step 3: Now navigate to a particular directory and press the bellow command to create the angular project
$ ng new my-app
Step 4: Now change directory cd my-app and hit the bellow command to run the angular project
ng serve --open
so –open is used to open the project automatically in the default browser with http://localhost:4200/