WHAT AND WHY Angular 2?
Angular 2
Angular
2 is an open source JavaScript framework to build web applications in HTML and
JavaScript/TypeScript
Angular 1vs 2
Angular
1 core concept was $scope, application more or less moving around $scope, Controller/ Services , and you will not find $scope ( Replacement of
$Scope is Components” ) in angular 2.0. Angular 2 is using zone.js to detect
changes
Angular
2 is completely rewritten.
Angular
2 is using Typescript which is super set of javascript
Angular
1 was not built with mobile support in mind, Angular 2 is mobile oriented
Benefits/Usages
1 Easy
to learn for those from Java/c#.Net Background (Typescript is oops
orientated)
ECMAScript
and other languages that compile to JavaScript(using Grunt,gulp).
3 Angular
2 is mobile oriented
4 Replacement
of $Scope is “Components”
Syntax and Code Snippet
import { Component } from '@angular/core';
@Component({
selector: 'myapp',
template: `<h1>Hello
{{name}}</h1>`
})
export class AppComponent { name
= 'Angular2'; }
.html body section
<body>
<myapp>Loading Please wait ...</myapp>
</body>
Common Syntax
@Component
The@Component is
a decorator which uses configuration object to create the component and its
view
Selector
The selector creates an instance of the component where it
finds <myapp> tag in parent HTML
template/ templateUrl
The template tells
Angular how to display the component.
we
can create html pages and navigate through site map/url for templateUrl
[]-Property Bindings
[()]- Angular 2, two-way binding
()-event binding- (associating events like .click, and many more)
{{}} --template expression
WHAT AND WHY Angular 2?
Reviewed by Rupesh
on
03:56
Rating:
No comments: