SlideShare a Scribd company logo
 
Nagaraju Sangam
AngularBuff@ ADP
nagaraju_sangam@yahoo.co.i
n
Speakerat various FrontEnd Meetups
nagaraju.sangam@gmail.com
 Script Errors?? God Only Knows 
 Errors in templates?? Even God doesn’t know..!!! 
 Different ways to create different things: provider, factoy, service, value, constant
 Opinionated, Verbose, steep learning curve
 Everything is singleton 
 Not an elegant dependency injection
 Route: No built-in partial view support using ng-route , Routing based on template, not directives
 Issues with Scope & child scopes
 Dirty checking
 Issues with digest cycles: $scope.apply();
 Two way data binding: Max of 2000 bindings.
 jqLite: No direct modification of dom??? dropped in 2.0 
 Directives supports “EACM” only no way to use selectors.
 modules : No built-in module loading
 No inheritance supported for angular modules
 To knock off many old components.
i.e. $scope, $rootScope, services, controllers, modules, jqLite etc.
 To leverage latest ECMA Script standards
 To leverage modern browser capabilities.
 Improve many areas with different approaches with past expirience.
Routing
Services
DI
Directives
ES5 & ES6+
Server Side
Angular
Change Detection
Web workers
Promises
Testing
Material design
RxJsTypes
Annotations
Angular JS 1.x Angular JS 2.0
Controllervs
$scopeecives
Component Class
Service Simple Class
Angular Modules ES6 Modules
Directive
Filters Pipes
 Converts source code from one programming language to other.
 ES6 to ES5 Transpilers
 Traceur
 Typescript
 Flow
 Babel
 Dart
 Angular2 apps should be written in ES6. since the browsers doesn’t support ES6 you can use any of the above
transpiler to convert it to ES5.
 Google and Microsoft are working together to make type script as a standard for developing angular2.0 apps.
http://www.2ality.com/2014/10/typed-javascript.html
ES
6
ES
5
Type
s
Annotatio
ns
AtScript
Type script
Angular 1.X Angular 2.0
 Change detection happens at DOM node level
only
 Change in one node triggers dirty checking at all
other nodes.
 Change detection can happen at component level as
well.
 Change in one component triggers dirty checking in
other nodes below the current node…
 Change detection strategy can be configured at
component level
@Component({
selector: <string>‘,
changeDetection: ‘<string>’
})
@View({
template: ‘<string>’
})
export class <className>{
constructor() {
}
}
 The changeDetection property defines, whether the change detection will be
checked every time or only when the component tells it to do so.
Watchtower.js is used for change detection.
 Routing happens at component level, for each different route different component can be loaded into RouterOutlet
directive, it is similar to ui-view in angular 1.X.
@RouteConfig([
{ path: '/', redirectTo: '/sponsers' },
{ path: '/sponsers', component: Sponsers, as: 'sponsers'}, //sponsers & attendees are components
{ path: '/attendees', component: Attendees, as: 'attendees'}
])
<router-outlet></router-outlet>
 Router-Link is similar to hg-href in 1.X.
<a [router-link]="['/attendees']" router-params="">attendees</a>
 JSON based route config
 404 support
 QueryString support
 Lyfecycle events
 routeResolver
 Component Directives
 Attribute Directives
 Structural Directives
Following annotations are used to create directives.
 @Directive
 @Component
http://www.2ality.com/2014/10/typed-javascript.html
Service is a simple ES6 class in Angular2, these services should be injected into components via
Dependency Injection.
Sponsers-Service.ts
export class SponsersService{
constructor() {
}
getData(){
return ['cisco','intel','flipkart'];
}
}
http://www.2ality.com/2014/10/typed-javascript.html
http://www.2ality.com/2014/10/typed-javascript.html
Http is available as a separate module in alpha 35: https://code.angularjs.org/2.0.0-alpha.35
Eg:
import {Http, httpInjectables} from 'angular2/http';
@Component({selector: 'http-app', viewBindings: [httpInjectables]})
@View({templateUrl: 'people.html'})
class PeopleComponent {
constructor(http: Http) {
http.get('people.json‘)
.subscribe(people => this.people = people);
}
}
 Dependencies can be specifies as parameters: eg: function(@Inject(<svcName>) s)
 Component dependencies should be listed in bindings property of @Component annotation.
 Template dependencies should be listed in directives property of @View annotation.
http://www.2ality.com/2014/10/typed-javascript.html
import {Component, View, Injector} from 'angular2/angular2';
import { NgFor } from 'angular2/angular2';
import {SponsersService} from 'services/sponsers-service';
@Component({
selector: 'sponsers',
bindings:[SponsersService]
})
@View({
template: '<ul><li *ng-for="#item of data">{{item}}</li></ul>',
directives:[NgFor]
})
export class Sponsers {
data;
constructor(@Inject(SponsersService) s) {
this.data = s.getData();
}
}
Main-thread
(Browser+App+Angular Dom renderer)
messages
Child thread
(Angular stuff – house keeping etc)
 http://angular.io
 www.victorsavkin.com
 www.tryangular2.com
 http://www.syntaxsuccess.com/viewarticle/routing-in-angular-2.0
 http://blog.thoughtram.io/angular/2015/06/16/routing-in-angular-2.html
https://github.com/nasangam
Angular js 2.0

More Related Content

What's hot (20)

PPTX
Angular 1.x vs 2 - In code level
Anuradha Bandara
 
PDF
React js use contexts and useContext hook
Piyush Jamwal
 
PPTX
Single Page Applications with AngularJS 2.0
Sumanth Chinthagunta
 
PPTX
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
PDF
Workshop 22: React-Redux Middleware
Visual Engineering
 
PDF
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
Codemotion
 
PPTX
Angular 5
Bartłomiej Narożnik
 
PPTX
Crossant Run Modes
Ajay Singh
 
PDF
Angular2 intro
Shawn McKay
 
PPTX
Angular 2 + TypeScript = true. Let's Play!
Sirar Salih
 
PPTX
Angular 1.x in action now
GDG Odessa
 
PPTX
React and Flux life cycle with JSX, React Router and Jest Unit Testing
Eswara Kumar Palakollu
 
PPTX
AngularJS2 / TypeScript / CLI
Domenico Rutigliano
 
PDF
AngularJS application architecture
Gabriele Falace
 
PDF
Angular2 with type script
Ravi Mone
 
PPTX
AngularJS for Java Developers
Loc Nguyen
 
PDF
Understanding Facebook's React.js
Federico Torre
 
PDF
Introduction to React Hooks
Felicia O'Garro
 
PDF
Angular2 - In Action
Sebastian Pożoga
 
PPTX
Introduction to Angular js 2.0
Nagaraju Sangam
 
Angular 1.x vs 2 - In code level
Anuradha Bandara
 
React js use contexts and useContext hook
Piyush Jamwal
 
Single Page Applications with AngularJS 2.0
Sumanth Chinthagunta
 
Migrating an application from Angular 1 to Angular 2
Ross Dederer
 
Workshop 22: React-Redux Middleware
Visual Engineering
 
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
Codemotion
 
Crossant Run Modes
Ajay Singh
 
Angular2 intro
Shawn McKay
 
Angular 2 + TypeScript = true. Let's Play!
Sirar Salih
 
Angular 1.x in action now
GDG Odessa
 
React and Flux life cycle with JSX, React Router and Jest Unit Testing
Eswara Kumar Palakollu
 
AngularJS2 / TypeScript / CLI
Domenico Rutigliano
 
AngularJS application architecture
Gabriele Falace
 
Angular2 with type script
Ravi Mone
 
AngularJS for Java Developers
Loc Nguyen
 
Understanding Facebook's React.js
Federico Torre
 
Introduction to React Hooks
Felicia O'Garro
 
Angular2 - In Action
Sebastian Pożoga
 
Introduction to Angular js 2.0
Nagaraju Sangam
 

Similar to Angular js 2.0 (20)

PPTX
Angular workshop - Full Development Guide
Nitin Giri
 
PPTX
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
PDF
Voorhoede - Front-end architecture
Jasper Moelker
 
PPTX
Vue 2.0 + Vuex Router & Vuex at Vue.js
Takuya Tejima
 
PPTX
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
murtazahaveliwala
 
PPTX
Intoduction to Angularjs
Gaurav Agrawal
 
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
PPTX
Angular js workshop
Rolands Krumbergs
 
PPTX
Understanding angular js
Aayush Shrestha
 
ODP
AngularJs Crash Course
Keith Bloomfield
 
PPTX
angularJs Workshop
Ran Wahle
 
PPT
Angular js
yogi_solanki
 
PPTX
Introduction to Angularjs
Manish Shekhawat
 
PDF
Introduction to Angularjs : kishan kumar
Appfinz Technologies
 
PPTX
Reactive application using meteor
Sapna Upreti
 
PPT
Angular js
Hritesh Saha
 
PPTX
Angular interview questions
Goa App
 
PPTX
Angular - Beginner
Riccardo Masetti
 
PPTX
Angular2 + rxjs
Christoffer Noring
 
PPTX
Angular%201%20to%20angular%202
Ran Wahle
 
Angular workshop - Full Development Guide
Nitin Giri
 
ME vs WEB - AngularJS Fundamentals
Aviran Cohen
 
Voorhoede - Front-end architecture
Jasper Moelker
 
Vue 2.0 + Vuex Router & Vuex at Vue.js
Takuya Tejima
 
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
murtazahaveliwala
 
Intoduction to Angularjs
Gaurav Agrawal
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
Angular js workshop
Rolands Krumbergs
 
Understanding angular js
Aayush Shrestha
 
AngularJs Crash Course
Keith Bloomfield
 
angularJs Workshop
Ran Wahle
 
Angular js
yogi_solanki
 
Introduction to Angularjs
Manish Shekhawat
 
Introduction to Angularjs : kishan kumar
Appfinz Technologies
 
Reactive application using meteor
Sapna Upreti
 
Angular js
Hritesh Saha
 
Angular interview questions
Goa App
 
Angular - Beginner
Riccardo Masetti
 
Angular2 + rxjs
Christoffer Noring
 
Angular%201%20to%20angular%202
Ran Wahle
 
Ad

Recently uploaded (20)

PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPTX
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PPTX
Mathematics 5 - Time Measurement: Time Zone
menchreo
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PPTX
grade 5 lesson ENGLISH 5_Q1_PPT_WEEK3.pptx
SireQuinn
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
Pyhton with Mysql to perform CRUD operations.pptx
Ramakrishna Reddy Bijjam
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
THE TAME BIRD AND THE FREE BIRD.pptxxxxx
MarcChristianNicolas
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Mathematics 5 - Time Measurement: Time Zone
menchreo
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
community health nursing question paper 2.pdf
Prince kumar
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
Dimensions of Societal Planning in Commonism
StefanMz
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
grade 5 lesson ENGLISH 5_Q1_PPT_WEEK3.pptx
SireQuinn
 
Ad

Angular js 2.0

  • 3.  Script Errors?? God Only Knows   Errors in templates?? Even God doesn’t know..!!!   Different ways to create different things: provider, factoy, service, value, constant  Opinionated, Verbose, steep learning curve  Everything is singleton   Not an elegant dependency injection  Route: No built-in partial view support using ng-route , Routing based on template, not directives  Issues with Scope & child scopes  Dirty checking  Issues with digest cycles: $scope.apply();  Two way data binding: Max of 2000 bindings.  jqLite: No direct modification of dom??? dropped in 2.0   Directives supports “EACM” only no way to use selectors.  modules : No built-in module loading  No inheritance supported for angular modules
  • 4.  To knock off many old components. i.e. $scope, $rootScope, services, controllers, modules, jqLite etc.  To leverage latest ECMA Script standards  To leverage modern browser capabilities.  Improve many areas with different approaches with past expirience.
  • 5. Routing Services DI Directives ES5 & ES6+ Server Side Angular Change Detection Web workers Promises Testing Material design RxJsTypes Annotations
  • 6. Angular JS 1.x Angular JS 2.0 Controllervs $scopeecives Component Class Service Simple Class Angular Modules ES6 Modules Directive Filters Pipes
  • 7.  Converts source code from one programming language to other.  ES6 to ES5 Transpilers  Traceur  Typescript  Flow  Babel  Dart  Angular2 apps should be written in ES6. since the browsers doesn’t support ES6 you can use any of the above transpiler to convert it to ES5.  Google and Microsoft are working together to make type script as a standard for developing angular2.0 apps. http://www.2ality.com/2014/10/typed-javascript.html
  • 9. Angular 1.X Angular 2.0  Change detection happens at DOM node level only  Change in one node triggers dirty checking at all other nodes.  Change detection can happen at component level as well.  Change in one component triggers dirty checking in other nodes below the current node…  Change detection strategy can be configured at component level
  • 10. @Component({ selector: <string>‘, changeDetection: ‘<string>’ }) @View({ template: ‘<string>’ }) export class <className>{ constructor() { } }  The changeDetection property defines, whether the change detection will be checked every time or only when the component tells it to do so. Watchtower.js is used for change detection.
  • 11.  Routing happens at component level, for each different route different component can be loaded into RouterOutlet directive, it is similar to ui-view in angular 1.X. @RouteConfig([ { path: '/', redirectTo: '/sponsers' }, { path: '/sponsers', component: Sponsers, as: 'sponsers'}, //sponsers & attendees are components { path: '/attendees', component: Attendees, as: 'attendees'} ]) <router-outlet></router-outlet>  Router-Link is similar to hg-href in 1.X. <a [router-link]="['/attendees']" router-params="">attendees</a>  JSON based route config  404 support  QueryString support  Lyfecycle events  routeResolver
  • 12.  Component Directives  Attribute Directives  Structural Directives Following annotations are used to create directives.  @Directive  @Component http://www.2ality.com/2014/10/typed-javascript.html
  • 13. Service is a simple ES6 class in Angular2, these services should be injected into components via Dependency Injection. Sponsers-Service.ts export class SponsersService{ constructor() { } getData(){ return ['cisco','intel','flipkart']; } } http://www.2ality.com/2014/10/typed-javascript.html
  • 14. http://www.2ality.com/2014/10/typed-javascript.html Http is available as a separate module in alpha 35: https://code.angularjs.org/2.0.0-alpha.35 Eg: import {Http, httpInjectables} from 'angular2/http'; @Component({selector: 'http-app', viewBindings: [httpInjectables]}) @View({templateUrl: 'people.html'}) class PeopleComponent { constructor(http: Http) { http.get('people.json‘) .subscribe(people => this.people = people); } }
  • 15.  Dependencies can be specifies as parameters: eg: function(@Inject(<svcName>) s)  Component dependencies should be listed in bindings property of @Component annotation.  Template dependencies should be listed in directives property of @View annotation. http://www.2ality.com/2014/10/typed-javascript.html import {Component, View, Injector} from 'angular2/angular2'; import { NgFor } from 'angular2/angular2'; import {SponsersService} from 'services/sponsers-service'; @Component({ selector: 'sponsers', bindings:[SponsersService] }) @View({ template: '<ul><li *ng-for="#item of data">{{item}}</li></ul>', directives:[NgFor] }) export class Sponsers { data; constructor(@Inject(SponsersService) s) { this.data = s.getData(); } }
  • 16. Main-thread (Browser+App+Angular Dom renderer) messages Child thread (Angular stuff – house keeping etc)
  • 17.  http://angular.io  www.victorsavkin.com  www.tryangular2.com  http://www.syntaxsuccess.com/viewarticle/routing-in-angular-2.0  http://blog.thoughtram.io/angular/2015/06/16/routing-in-angular-2.html