SlideShare a Scribd company logo
Moving From AngularJS to
Angular 2
By Ahamed Imran
@immysl
“AngularJS is a framework.
Angular 2 is a platform”
- Brad Green -
Why Angular 2?
• Cross platform
• Very good performance
• Good tooling support (IDEs and CLI tool)
• Ecosystem — RxJS, TypeScript, NativeScript, etc.
• Very good mobile support
“The value in TypeScript is in
writing safer code”
- John Papa -
Why TypeScript?
• Check for errors at compile time
• Good tooling support
• Is a mix of types, ES2015 and ESNext
• The fastest growing superset of JavaScript
• Compatibility with non-TypeScript libraries
Moving From AngularJS to  Angular 2
What has changed?
• There are components — No controllers
• There are services — No providers and factories
• There are zones — No $scope
• There are APIs for DOM manipulation — No jqLite
• One way data flow — No two way data flow
Moving From AngularJS to  Angular 2
Angular 2 Concepts
• Components
• Dependency Injection
• Data Binding
• Metadata / decorators
• Modules
Components
• Inputs
• Outputs / events
• Lifecycle
• Providers
• Template
Components Example
@Component({
selector: 'my-component',
providers: [MyService],
template: ‘<p *ngFor=”let item of list” (click)=”sendUpdate()”>{{ item }}</p>’,
styles: [‘p { font-size: 14px }’]
})
class MyComponent implements OnInit {
@Input() list;
@Output() update = new EventEmitter();
ngOnInit() { } // get async data
sendUpdate() { this.update.emit(‘some value’) }
}
Dependency Injection Example
@Component({
...
providers: [MyService]
})
export class MyComponent {
constructor(private service: MyService) {} // inject here
ngOnInit() {
service.getList(); // this is just a dummy line
}
}
Data Binding
• Interpolation
• Property binding (inputs)
• Event binding (outputs)
• Two-way binding
// example
<my-component [title]=”list” (update)=”getUpdate($event)”></my-component>
Metadata / Decorators
@Component({
selector: '...',
template: ‘<h2>{{title}}</h2>’
})
// common decorators
@Input()
@Output()
@Pipe()
@Injectable()
Modules
• Brand new — released yesterday
• Somewhat similar to AngularJS module
• An app needs to have a root module
• Separate modules based on features
• Not same as JavaScript / TypeScript modules
Modules Example
import { NgModule } from ‘@angular/core’;
import { BrowserModule } from ‘@angular/platform-browser’;
Import { MyComponent } from ‘./my.component’;
@NgModule({
imports: [BrowserModule],
providers: [MyService],
declarations: [MyComponent, MyDirective, MyPipe],
bootstrap: [AppComponent]
})
export class AppModule { }
Angular Libraries
• Router
• Form
• Upgrade
• Compiler
• Compiler-cli
Moving From AngularJS to  Angular 2
Angular CLI
• Official scaffolding and build tool for Angular 2
• Maintained by the Angular team
• Latest uses Webpack for build and server
• Currently as a command-line tool only
Other Tools
• Codelyzer — style guide checker
• Augury — Angular 2 debugger as a Chrome extension
• Lite-server — A live reload server for Angular
Demo
Norway
+47 959 23 712
oslo@exilesoft.com
Stortorvet 10
0155 Oslo
Norway
Sweden
+46 735 194 442
stockholm@exilesoft.com
Stockholmsvägen 33
181 33 Lidingö
Sweden
Australia
+61 412 446 105
sydney@exilesoft.com
Suite2.14, 32 Delhi Road
North Ryde, NSW 2113
Australia
Sri Lanka
+94 112 300 900
colombo@exilesoft.com
201, Sir James Peiris Mw.
Colombo 02
Sri Lanka
www.exilesoft.com

More Related Content

PPTX
Angular js for Beginnners
PDF
PPTX
Introduction to Angular JS
PDF
Introduction to VIPER Architecture
PDF
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
PPTX
Angular JS Indtrodution
PDF
Understanding Facebook's React.js
PPTX
Lets go vanilla
Angular js for Beginnners
Introduction to Angular JS
Introduction to VIPER Architecture
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Angular JS Indtrodution
Understanding Facebook's React.js
Lets go vanilla

What's hot (20)

PPTX
Introducing angular
PDF
React vs-angular-mobile
PDF
Introduction to react
PPSX
React introduction
PDF
Marrying angular rails
PDF
2013 - Nate Abele Wield AngularJS like a Pro
PDF
Reacting to the Isomorphic Buzz
PDF
Angular basicschat
PPTX
Understanding Javascript AJAX - Imrokraft
PDF
From ActiveRecord to EventSourcing
PDF
Infinum iOS Talks #4 - Making our VIPER more reactive
PPTX
PPTX
AngularJS
PPTX
Binary Studio Academy PRO. JS course. Lecture 2. backbone
PPTX
Angular js
PDF
React.js - and how it changed our thinking about UI
PPTX
AngularJS
PDF
modularity à la taliban
PDF
Angular js 2.0, ng poznań 20.11
ODP
Scheduler_session
Introducing angular
React vs-angular-mobile
Introduction to react
React introduction
Marrying angular rails
2013 - Nate Abele Wield AngularJS like a Pro
Reacting to the Isomorphic Buzz
Angular basicschat
Understanding Javascript AJAX - Imrokraft
From ActiveRecord to EventSourcing
Infinum iOS Talks #4 - Making our VIPER more reactive
AngularJS
Binary Studio Academy PRO. JS course. Lecture 2. backbone
Angular js
React.js - and how it changed our thinking about UI
AngularJS
modularity à la taliban
Angular js 2.0, ng poznań 20.11
Scheduler_session
Ad

Viewers also liked (16)

PDF
Hojadevidapersonal1.docx
DOCX
PPTX
Zimmilo ENG July 2016
PDF
Resume_Mayalagu updated
PPTX
El romance tg
PDF
شهادات محمد عطية.PDF
PDF
PPTX
progress_PPT
DOCX
Harinanden New Resume v5
DOCX
R. Seth Penny-Percentage Paper
PDF
(2011) Rigaud, David, Daudet - A Parametric Model of Piano Tuning
PPTX
Forxtrust
PPTX
the 21st Century Digital Learner
PDF
Eco borbur ingenieros constructores
PPTX
Smokeless tobacco
Hojadevidapersonal1.docx
Zimmilo ENG July 2016
Resume_Mayalagu updated
El romance tg
شهادات محمد عطية.PDF
progress_PPT
Harinanden New Resume v5
R. Seth Penny-Percentage Paper
(2011) Rigaud, David, Daudet - A Parametric Model of Piano Tuning
Forxtrust
the 21st Century Digital Learner
Eco borbur ingenieros constructores
Smokeless tobacco
Ad

Similar to Moving From AngularJS to Angular 2 (20)

PPTX
Angular 2
PPTX
An afternoon with angular 2
PPTX
PPTX
An evening with Angular 2
PDF
Angular2 with type script
PPT
Angular.ppt
PPTX
Dive into Angular, part 4: Angular 2.0
PDF
better-apps-angular-2-day1.pdf and home
PDF
Angular2 Development for Java developers
PDF
Angular 2: What's New?
PDF
Angular2 tutorial
PPTX
Angular 2 with typescript
PPTX
What's new in Angular 2?
PDF
Angular 2 - An Introduction
PDF
Angular2
PPTX
Angular2 + rxjs
PPTX
Angular 2 KTS
PDF
Angular 2 for Java Developers
PPTX
Introduction to Angular2
PPTX
Introduction to angular 2
Angular 2
An afternoon with angular 2
An evening with Angular 2
Angular2 with type script
Angular.ppt
Dive into Angular, part 4: Angular 2.0
better-apps-angular-2-day1.pdf and home
Angular2 Development for Java developers
Angular 2: What's New?
Angular2 tutorial
Angular 2 with typescript
What's new in Angular 2?
Angular 2 - An Introduction
Angular2
Angular2 + rxjs
Angular 2 KTS
Angular 2 for Java Developers
Introduction to Angular2
Introduction to angular 2

Recently uploaded (20)

PDF
Digital Strategies for Manufacturing Companies
DOCX
The Five Best AI Cover Tools in 2025.docx
PDF
Best Practices for Rolling Out Competency Management Software.pdf
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
Presentation of Computer CLASS 2 .pptx
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PPTX
AIRLINE PRICE API | FLIGHT API COST |
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
top salesforce developer skills in 2025.pdf
PDF
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
Digital Strategies for Manufacturing Companies
The Five Best AI Cover Tools in 2025.docx
Best Practices for Rolling Out Competency Management Software.pdf
A REACT POMODORO TIMER WEB APPLICATION.pdf
PTS Company Brochure 2025 (1).pdf.......
How to Choose the Right IT Partner for Your Business in Malaysia
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Online Work Permit System for Fast Permit Processing
ISO 45001 Occupational Health and Safety Management System
Presentation of Computer CLASS 2 .pptx
Materi_Pemrograman_Komputer-Looping.pptx
AIRLINE PRICE API | FLIGHT API COST |
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
How Creative Agencies Leverage Project Management Software.pdf
Understanding Forklifts - TECH EHS Solution
top salesforce developer skills in 2025.pdf
QAware_Mario-Leander_Reimer_Architecting and Building a K8s-based AI Platform...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Which alternative to Crystal Reports is best for small or large businesses.pdf

Moving From AngularJS to Angular 2

  • 1. Moving From AngularJS to Angular 2 By Ahamed Imran @immysl
  • 2. “AngularJS is a framework. Angular 2 is a platform” - Brad Green -
  • 3. Why Angular 2? • Cross platform • Very good performance • Good tooling support (IDEs and CLI tool) • Ecosystem — RxJS, TypeScript, NativeScript, etc. • Very good mobile support
  • 4. “The value in TypeScript is in writing safer code” - John Papa -
  • 5. Why TypeScript? • Check for errors at compile time • Good tooling support • Is a mix of types, ES2015 and ESNext • The fastest growing superset of JavaScript • Compatibility with non-TypeScript libraries
  • 7. What has changed? • There are components — No controllers • There are services — No providers and factories • There are zones — No $scope • There are APIs for DOM manipulation — No jqLite • One way data flow — No two way data flow
  • 9. Angular 2 Concepts • Components • Dependency Injection • Data Binding • Metadata / decorators • Modules
  • 10. Components • Inputs • Outputs / events • Lifecycle • Providers • Template
  • 11. Components Example @Component({ selector: 'my-component', providers: [MyService], template: ‘<p *ngFor=”let item of list” (click)=”sendUpdate()”>{{ item }}</p>’, styles: [‘p { font-size: 14px }’] }) class MyComponent implements OnInit { @Input() list; @Output() update = new EventEmitter(); ngOnInit() { } // get async data sendUpdate() { this.update.emit(‘some value’) } }
  • 12. Dependency Injection Example @Component({ ... providers: [MyService] }) export class MyComponent { constructor(private service: MyService) {} // inject here ngOnInit() { service.getList(); // this is just a dummy line } }
  • 13. Data Binding • Interpolation • Property binding (inputs) • Event binding (outputs) • Two-way binding // example <my-component [title]=”list” (update)=”getUpdate($event)”></my-component>
  • 14. Metadata / Decorators @Component({ selector: '...', template: ‘<h2>{{title}}</h2>’ }) // common decorators @Input() @Output() @Pipe() @Injectable()
  • 15. Modules • Brand new — released yesterday • Somewhat similar to AngularJS module • An app needs to have a root module • Separate modules based on features • Not same as JavaScript / TypeScript modules
  • 16. Modules Example import { NgModule } from ‘@angular/core’; import { BrowserModule } from ‘@angular/platform-browser’; Import { MyComponent } from ‘./my.component’; @NgModule({ imports: [BrowserModule], providers: [MyService], declarations: [MyComponent, MyDirective, MyPipe], bootstrap: [AppComponent] }) export class AppModule { }
  • 17. Angular Libraries • Router • Form • Upgrade • Compiler • Compiler-cli
  • 19. Angular CLI • Official scaffolding and build tool for Angular 2 • Maintained by the Angular team • Latest uses Webpack for build and server • Currently as a command-line tool only
  • 20. Other Tools • Codelyzer — style guide checker • Augury — Angular 2 debugger as a Chrome extension • Lite-server — A live reload server for Angular
  • 21. Demo
  • 22. Norway +47 959 23 712 [email protected] Stortorvet 10 0155 Oslo Norway Sweden +46 735 194 442 [email protected] Stockholmsvägen 33 181 33 Lidingö Sweden Australia +61 412 446 105 [email protected] Suite2.14, 32 Delhi Road North Ryde, NSW 2113 Australia Sri Lanka +94 112 300 900 [email protected] 201, Sir James Peiris Mw. Colombo 02 Sri Lanka www.exilesoft.com