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

PPTX
Angular js 2.0 beta
PPTX
AngularJS 2.0
ODP
Introduction to Angular 2
PPTX
React-JS Component Life-cycle Methods
PDF
The evolution of Angular 2 @ AngularJS Munich Meetup #5
PPTX
Angular js 2
PDF
Workshop 16: EmberJS Parte I
PPTX
Angular1x and Angular 2 for Beginners
Angular js 2.0 beta
AngularJS 2.0
Introduction to Angular 2
React-JS Component Life-cycle Methods
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Angular js 2
Workshop 16: EmberJS Parte I
Angular1x and Angular 2 for Beginners

What's hot (20)

PPTX
Angular 1.x vs 2 - In code level
PDF
React js use contexts and useContext hook
PPTX
Single Page Applications with AngularJS 2.0
PPTX
Migrating an application from Angular 1 to Angular 2
PDF
Workshop 22: React-Redux Middleware
PDF
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
PPTX
PPTX
Crossant Run Modes
PDF
Angular2 intro
PPTX
Angular 2 + TypeScript = true. Let's Play!
PPTX
Angular 1.x in action now
PPTX
React and Flux life cycle with JSX, React Router and Jest Unit Testing
PPTX
AngularJS2 / TypeScript / CLI
PDF
AngularJS application architecture
PDF
Angular2 with type script
PPTX
AngularJS for Java Developers
PDF
Understanding Facebook's React.js
PDF
Introduction to React Hooks
PDF
Angular2 - In Action
PPTX
Introduction to Angular js 2.0
Angular 1.x vs 2 - In code level
React js use contexts and useContext hook
Single Page Applications with AngularJS 2.0
Migrating an application from Angular 1 to Angular 2
Workshop 22: React-Redux Middleware
AngularJS 2.0: A natural evolvement or a new beginning - Boyan Mihaylov - Cod...
Crossant Run Modes
Angular2 intro
Angular 2 + TypeScript = true. Let's Play!
Angular 1.x in action now
React and Flux life cycle with JSX, React Router and Jest Unit Testing
AngularJS2 / TypeScript / CLI
AngularJS application architecture
Angular2 with type script
AngularJS for Java Developers
Understanding Facebook's React.js
Introduction to React Hooks
Angular2 - In Action
Introduction to Angular js 2.0
Ad

Similar to Angular js 2.0 (20)

PPTX
Angular workshop - Full Development Guide
PPTX
ME vs WEB - AngularJS Fundamentals
PDF
Voorhoede - Front-end architecture
PPTX
Vue 2.0 + Vuex Router & Vuex at Vue.js
PPTX
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
PPTX
Intoduction to Angularjs
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
PPTX
Angular js workshop
PPTX
Understanding angular js
ODP
AngularJs Crash Course
PPTX
angularJs Workshop
PPT
Angular js
PDF
Introduction to Angularjs : kishan kumar
PPTX
Introduction to Angularjs
PPTX
Reactive application using meteor
PPT
Angular js
PPTX
Angular interview questions
PPTX
Angular - Beginner
PPTX
Angular2 + rxjs
PPTX
Angular%201%20to%20angular%202
Angular workshop - Full Development Guide
ME vs WEB - AngularJS Fundamentals
Voorhoede - Front-end architecture
Vue 2.0 + Vuex Router & Vuex at Vue.js
Angular training - Day 3 - custom directives, $http, $resource, setup with ye...
Intoduction to Angularjs
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
Angular js workshop
Understanding angular js
AngularJs Crash Course
angularJs Workshop
Angular js
Introduction to Angularjs : kishan kumar
Introduction to Angularjs
Reactive application using meteor
Angular js
Angular interview questions
Angular - Beginner
Angular2 + rxjs
Angular%201%20to%20angular%202
Ad

Recently uploaded (20)

PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Classroom Observation Tools for Teachers
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Lesson notes of climatology university.
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
master seminar digital applications in india
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
O7-L3 Supply Chain Operations - ICLT Program
Classroom Observation Tools for Teachers
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
human mycosis Human fungal infections are called human mycosis..pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Microbial disease of the cardiovascular and lymphatic systems
O5-L3 Freight Transport Ops (International) V1.pdf
Computing-Curriculum for Schools in Ghana
Abdominal Access Techniques with Prof. Dr. R K Mishra
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Supply Chain Operations Speaking Notes -ICLT Program
Lesson notes of climatology university.
Chinmaya Tiranga quiz Grand Finale.pdf
Final Presentation General Medicine 03-08-2024.pptx
VCE English Exam - Section C Student Revision Booklet
master seminar digital applications in india
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

Angular js 2.0

  • 2. Nagaraju Sangam AngularBuff@ ADP nagaraju_sangam@yahoo.co.i n Speakerat various FrontEnd Meetups nagaraju.sangam@gmail.com
  • 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