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: 5

No comments:

All Rights Reserved by Technology from Developers Eye © 2014 - 2015
Powered By Blogger, Designed by Aadics
Disclaimers:: The information provided within this blogsite is for general informational purposes only. While we try to keep the information up-to-date and correct, there are no representations or warranties, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the information, products, services, or related graphics contained in this blogsite for any purpose.The author does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.

Contact Form

Name

Email *

Message *

Powered by Blogger.