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

What's hot (20)

PPTX
Introducing angular
Columbia Developers Guild
 
PDF
React vs-angular-mobile
Michael Haberman
 
PDF
Introduction to react
kiranabburi
 
PPSX
React introduction
Kashyap Parmar
 
PDF
Marrying angular rails
Volker Tietz
 
PDF
2013 - Nate Abele Wield AngularJS like a Pro
PHP Conference Argentina
 
PDF
Reacting to the Isomorphic Buzz
Bruce Coddington
 
PDF
Angular basicschat
Yu Jin
 
PPTX
Understanding Javascript AJAX - Imrokraft
imrokraft
 
PDF
From ActiveRecord to EventSourcing
Emanuele DelBono
 
PDF
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum
 
PPTX
Angular js
Rajashekar Bhagavatula
 
PPTX
AngularJS
Malin De Silva
 
PPTX
Binary Studio Academy PRO. JS course. Lecture 2. backbone
Binary Studio
 
PPTX
Angular js
Baldeep Sohal
 
PDF
React.js - and how it changed our thinking about UI
Marcin Grzywaczewski
 
PPTX
AngularJS
LearningTech
 
PDF
modularity à la taliban
jonsterling
 
PDF
Angular js 2.0, ng poznań 20.11
Kamil Augustynowicz
 
ODP
Scheduler_session
shivani garg
 
Introducing angular
Columbia Developers Guild
 
React vs-angular-mobile
Michael Haberman
 
Introduction to react
kiranabburi
 
React introduction
Kashyap Parmar
 
Marrying angular rails
Volker Tietz
 
2013 - Nate Abele Wield AngularJS like a Pro
PHP Conference Argentina
 
Reacting to the Isomorphic Buzz
Bruce Coddington
 
Angular basicschat
Yu Jin
 
Understanding Javascript AJAX - Imrokraft
imrokraft
 
From ActiveRecord to EventSourcing
Emanuele DelBono
 
Infinum iOS Talks #4 - Making our VIPER more reactive
Infinum
 
AngularJS
Malin De Silva
 
Binary Studio Academy PRO. JS course. Lecture 2. backbone
Binary Studio
 
Angular js
Baldeep Sohal
 
React.js - and how it changed our thinking about UI
Marcin Grzywaczewski
 
AngularJS
LearningTech
 
modularity à la taliban
jonsterling
 
Angular js 2.0, ng poznań 20.11
Kamil Augustynowicz
 
Scheduler_session
shivani garg
 

Viewers also liked (16)

PDF
Hojadevidapersonal1.docx
Aleja Chalama
 
DOCX
Casos
Aleja Chalama
 
PPTX
Zimmilo ENG July 2016
Roman Ruzinsky
 
PDF
Resume_Mayalagu updated
Mayalagu Karuppiah
 
PPTX
El romance tg
Cristina Dassum
 
PDF
شهادات محمد عطية.PDF
Mohammed Timraz
 
PDF
Flyer 4x9
Florence Turk Weber
 
PPTX
progress_PPT
Pranjal Barman
 
DOCX
Harinanden New Resume v5
Harinanden VK
 
DOCX
R. Seth Penny-Percentage Paper
Rohan Seth
 
PDF
(2011) Rigaud, David, Daudet - A Parametric Model of Piano Tuning
François Rigaud
 
PPTX
Forxtrust
Friday David
 
PPTX
the 21st Century Digital Learner
charmesintos123
 
PDF
Eco borbur ingenieros constructores
Jennsy Gonzalez
 
PPTX
Smokeless tobacco
Ankit Verma
 
Hojadevidapersonal1.docx
Aleja Chalama
 
Zimmilo ENG July 2016
Roman Ruzinsky
 
Resume_Mayalagu updated
Mayalagu Karuppiah
 
El romance tg
Cristina Dassum
 
شهادات محمد عطية.PDF
Mohammed Timraz
 
progress_PPT
Pranjal Barman
 
Harinanden New Resume v5
Harinanden VK
 
R. Seth Penny-Percentage Paper
Rohan Seth
 
(2011) Rigaud, David, Daudet - A Parametric Model of Piano Tuning
François Rigaud
 
Forxtrust
Friday David
 
the 21st Century Digital Learner
charmesintos123
 
Eco borbur ingenieros constructores
Jennsy Gonzalez
 
Smokeless tobacco
Ankit Verma
 
Ad

Similar to Moving From AngularJS to Angular 2 (20)

PPTX
Angular 2
Nigam Goyal
 
PPTX
An afternoon with angular 2
Mike Melusky
 
PPTX
Angular 2
Travis van der Font
 
PPTX
An evening with Angular 2
Mike Melusky
 
PDF
Angular2 with type script
Ravi Mone
 
PPT
Angular.ppt
Mytrux1
 
PPTX
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
PDF
better-apps-angular-2-day1.pdf and home
ChethanGowda886434
 
PDF
Angular2 Development for Java developers
Yakov Fain
 
PDF
Angular 2: What's New?
jbandi
 
PDF
Angular2 tutorial
HarikaReddy115
 
PPTX
Angular 2 with typescript
Tayseer_Emam
 
PPTX
What's new in Angular 2?
Alfred Jett Grandeza
 
PDF
Angular 2 - An Introduction
NexThoughts Technologies
 
PDF
Angular2
SitaPrajapati
 
PPTX
Angular2 + rxjs
Christoffer Noring
 
PPTX
Angular 2 KTS
John Vall
 
PDF
Angular 2 for Java Developers
Yakov Fain
 
PPTX
Introduction to Angular2
Knoldus Inc.
 
PPTX
Introduction to angular 2
Dor Moshe
 
Angular 2
Nigam Goyal
 
An afternoon with angular 2
Mike Melusky
 
An evening with Angular 2
Mike Melusky
 
Angular2 with type script
Ravi Mone
 
Angular.ppt
Mytrux1
 
Dive into Angular, part 4: Angular 2.0
Oleksii Prohonnyi
 
better-apps-angular-2-day1.pdf and home
ChethanGowda886434
 
Angular2 Development for Java developers
Yakov Fain
 
Angular 2: What's New?
jbandi
 
Angular2 tutorial
HarikaReddy115
 
Angular 2 with typescript
Tayseer_Emam
 
What's new in Angular 2?
Alfred Jett Grandeza
 
Angular 2 - An Introduction
NexThoughts Technologies
 
Angular2
SitaPrajapati
 
Angular2 + rxjs
Christoffer Noring
 
Angular 2 KTS
John Vall
 
Angular 2 for Java Developers
Yakov Fain
 
Introduction to Angular2
Knoldus Inc.
 
Introduction to angular 2
Dor Moshe
 
Ad

Recently uploaded (20)

PDF
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
PDF
NSF Converter Simplified: From Complexity to Clarity
Johnsena Crook
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
PPTX
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Everything you need to know about pricing & licensing Microsoft 365 Copilot f...
Q-Advise
 
NSF Converter Simplified: From Complexity to Clarity
Johnsena Crook
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
NEW-Viral>Wondershare Filmora 14.5.18.12900 Crack Free
sherryg1122g
 
Customise Your Correlation Table in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 

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