SlideShare a Scribd company logo
How to migrate from Angular
1
When you can’t use the
word “Big Bang”
• Mental Model
• Plan
• Case Study
• AngularJS
• ES6 & TypeScript
• Angular
Asim Hussain
@jawache
asim@codecraft.tv
700 page Angular book
ng2.codecraft.tv
Kickstarter Funded - FREE
Terminology
Angular = Angular 2+
AngularJS = Angular 1.x
Filters = Pipes
Controllers = Components
Directives + HTML = Components
Directives - HTML = Directives
Service/Factory = Service
Entity?
Migration or Upgrade?
DEMO
Mental Model
Multiple Personality Disorder
Service
List
Card
Spinner
Resource
Edit
Create
Search
1.x
Service
List
Card
Spinner
Resource
Edit
Create
Search
1.x
2+
Service
List
Card
Spinner
Resource
Edit
Create
Search
1.x
2+
Root is AngularJS
Zone ➡ $scope.$apply(…)
Cross Dresser
List
List
AngularJS
Downgraded
Angular
Angular
Upgraded
AngularJS
List ⬆
List ⬇
Service ⬇
List
Edit
Service
Control Freak
<card>
<body>
<spinner>
<card>
<body>
<spinner>
<card> ⬇
<body>
<spinner>
<body>
<spinner> ⬆
<card> ⬇
Disease
Service
List
Card
Spinner
Edit
Create
Search
1.x
2+
Resource ⬇
Service ⬇
List
Card
Spinner
Edit
Create
Search
1.x
2+
Resource
Service ⬇
List
Card ⬇
Spinner
Edit
Create
Search
1.x
2+
Resource
Service ⬇
List
Card ⬇
Spinner ⬇
Edit
Create
Search
1.x
2+
Resource
Service ⬇
List ⬇
Card
Spinner
Edit
Create
Search
1.x
2+
Resource
Service
List ⬇
Card
Spinner
Edit ⬇
Create ⬇
Search ⬇
1.x
2+
Resource
Service
List
Card
Spinner
Edit
Create
Search
2+
Resource
But…
• Filters
• (some) Directives
Asim’s 10 Step Plan
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Top Tips!
Start with the Router
CODE!
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Top Tips!
Start with the Service/Factories
$resource use $http
$q use Promise
.factory(..) use .service(..)
CODE!
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Service
List
Card
Spinner
Resource
Edit
Create
Search
1.x
Service
List
Card
Spinner
Resource
Edit
Create
Search
1.x
2+
Top Tips!
Remove ng-app
CODE!
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Service ⬇
List
Card
Spinner
Edit
Create
Search
1.x
2+
Resource
Top Tips!
• Re-write
• Find
• Upgrade
CODE!
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Service ⬇
List
Card ⬇
Spinner ⬇
Edit
Create
Search
1.x
2+
Resource
Service
List ⬇
Card
Spinner
Edit
Create
Search
1.x
2+
Resource
Service
List ⬇
Card
Spinner
Edit ⬇
Create
Search
1.x
2+
Resource
CODE!
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual Boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Tiny Pop
Angular Router
Add Root Component
Top Tips!
• Multiple named ui-views
• Multiple names router-outlets
CODE!
1. Style guide
2. TypeScript & build tools
3. AngularJS 1.5+
4. Component’ify
5. ES6’ify
6. Dual boot
7. Services to Angular
8. Components to Angular
9. Routing to Angular
10.Remove AngularJS
Service
List
Card
Spinner
Edit
Create
Search
2+
Resource
Finished
Questions?
codecraft.tv
@jawache

More Related Content

What's hot

Angular Best Practices v2
Angular Best Practices v2Angular Best Practices v2
Angular Best Practices v2
Henry Tao
 
An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJS
Yogesh singh
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
Trung Vo Tuan
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
Troy Miles
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
Alexandre Marreiros
 
Modules in AngularJs
Modules in AngularJsModules in AngularJs
Modules in AngularJs
K Arunkumar
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
Eusebiu Schipor
 
Listview and Adapter
Listview and AdapterListview and Adapter
Listview and Adapter
Arif Huda
 
Art of Building APIs
Art of Building APIsArt of Building APIs
Art of Building APIs
Jakub Nesetril
 
Try AngularJS
Try AngularJSTry AngularJS
Try AngularJS
Carlos Hernando
 
Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...
Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...
Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...
Techsylvania
 
Up & running with ECMAScript6
Up & running with ECMAScript6Up & running with ECMAScript6
Up & running with ECMAScript6
Nir Kaufman
 
Python for AngularJS
Python for AngularJSPython for AngularJS
Python for AngularJS
Jeff Schenck
 
I18n
I18nI18n
I18n
soon
 
Angular Classy
Angular ClassyAngular Classy
Angular Classy
Dave Jeffery
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
Henry Tao
 
Story ofcorespring infodeck
Story ofcorespring infodeckStory ofcorespring infodeck
Story ofcorespring infodeck
Makarand Bhatambarekar
 
Simple setup for an Angular EventEmitter
Simple setup for an Angular EventEmitterSimple setup for an Angular EventEmitter
Simple setup for an Angular EventEmitter
mike2071
 
Creating "The Second Best Place on the Internet" with Spring Initializr
Creating "The Second Best Place on the Internet" with Spring InitializrCreating "The Second Best Place on the Internet" with Spring Initializr
Creating "The Second Best Place on the Internet" with Spring Initializr
VMware Tanzu
 

What's hot (19)

Angular Best Practices v2
Angular Best Practices v2Angular Best Practices v2
Angular Best Practices v2
 
An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJS
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
 
Get satrted angular js
Get satrted angular jsGet satrted angular js
Get satrted angular js
 
Modules in AngularJs
Modules in AngularJsModules in AngularJs
Modules in AngularJs
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
 
Listview and Adapter
Listview and AdapterListview and Adapter
Listview and Adapter
 
Art of Building APIs
Art of Building APIsArt of Building APIs
Art of Building APIs
 
Try AngularJS
Try AngularJSTry AngularJS
Try AngularJS
 
Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...
Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...
Nicolas Grekas (Blackfire) – App Profiling - the Must-Have Tool of your Daily...
 
Up & running with ECMAScript6
Up & running with ECMAScript6Up & running with ECMAScript6
Up & running with ECMAScript6
 
Python for AngularJS
Python for AngularJSPython for AngularJS
Python for AngularJS
 
I18n
I18nI18n
I18n
 
Angular Classy
Angular ClassyAngular Classy
Angular Classy
 
AngularJS best-practices
AngularJS best-practicesAngularJS best-practices
AngularJS best-practices
 
Story ofcorespring infodeck
Story ofcorespring infodeckStory ofcorespring infodeck
Story ofcorespring infodeck
 
Simple setup for an Angular EventEmitter
Simple setup for an Angular EventEmitterSimple setup for an Angular EventEmitter
Simple setup for an Angular EventEmitter
 
Creating "The Second Best Place on the Internet" with Spring Initializr
Creating "The Second Best Place on the Internet" with Spring InitializrCreating "The Second Best Place on the Internet" with Spring Initializr
Creating "The Second Best Place on the Internet" with Spring Initializr
 

Viewers also liked

Drupal 8 & Commerce 2.x insights
Drupal 8 & Commerce 2.x insightsDrupal 8 & Commerce 2.x insights
Drupal 8 & Commerce 2.x insights
Nayan Velde
 
Blockchain Brochure - Open Reply
Blockchain Brochure - Open ReplyBlockchain Brochure - Open Reply
Blockchain Brochure - Open Reply
Ausrine S.
 
Oracle racからaurora my sqlへの移行
Oracle racからaurora my sqlへの移行Oracle racからaurora my sqlへの移行
Oracle racからaurora my sqlへの移行
recotech
 
Can We Assess Creativity?
Can We Assess Creativity?Can We Assess Creativity?
Can We Assess Creativity?
John Spencer
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
Natasha Murashev
 
Decatizing
DecatizingDecatizing
Decatizing
Ankur Thakuria
 
How Marketo Uses Marketo
How Marketo Uses MarketoHow Marketo Uses Marketo
How Marketo Uses Marketo
Marketo
 
Work Hacks - Productivity Hacks to Optimize Your Time & Maximize Results
Work Hacks - Productivity Hacks to Optimize Your Time & Maximize ResultsWork Hacks - Productivity Hacks to Optimize Your Time & Maximize Results
Work Hacks - Productivity Hacks to Optimize Your Time & Maximize Results
James Christopher
 
The Pavallion Dharamshala by HPCA
The Pavallion Dharamshala by HPCAThe Pavallion Dharamshala by HPCA
The Pavallion Dharamshala by HPCA
Sanjay Kumar Thakur
 
Reformas Loema – ¿Cómo trabajamos?
Reformas Loema – ¿Cómo trabajamos?Reformas Loema – ¿Cómo trabajamos?
Reformas Loema – ¿Cómo trabajamos?
Reformas Loema
 
BGB Construction (Pty) Ltd Profile
BGB Construction (Pty) Ltd   ProfileBGB Construction (Pty) Ltd   Profile
BGB Construction (Pty) Ltd Profile
Quintin R. Beukes
 
DESBRAVADORES INSTRUTOR DE ESPECIALIDADES
DESBRAVADORES INSTRUTOR DE ESPECIALIDADESDESBRAVADORES INSTRUTOR DE ESPECIALIDADES
DESBRAVADORES INSTRUTOR DE ESPECIALIDADES
DAVID HENRIQUE
 
Nuclear power station Energy
Nuclear power station EnergyNuclear power station Energy
Nuclear power station Energy
Md Farid Ahmed
 
Socceroos
SocceroosSocceroos
Socceroos
Social Figures
 
Resultados de Declaración de la Renta 2016 (IRPF 2015)
Resultados de Declaración de la Renta 2016 (IRPF 2015)Resultados de Declaración de la Renta 2016 (IRPF 2015)
Resultados de Declaración de la Renta 2016 (IRPF 2015)
Xtantos
 
Explaining Net Neutrality in less than 10 minutes
Explaining Net Neutrality in less than 10 minutesExplaining Net Neutrality in less than 10 minutes
Explaining Net Neutrality in less than 10 minutes
Toshiya Jitsuzumi
 

Viewers also liked (16)

Drupal 8 & Commerce 2.x insights
Drupal 8 & Commerce 2.x insightsDrupal 8 & Commerce 2.x insights
Drupal 8 & Commerce 2.x insights
 
Blockchain Brochure - Open Reply
Blockchain Brochure - Open ReplyBlockchain Brochure - Open Reply
Blockchain Brochure - Open Reply
 
Oracle racからaurora my sqlへの移行
Oracle racからaurora my sqlへの移行Oracle racからaurora my sqlへの移行
Oracle racからaurora my sqlへの移行
 
Can We Assess Creativity?
Can We Assess Creativity?Can We Assess Creativity?
Can We Assess Creativity?
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 
Decatizing
DecatizingDecatizing
Decatizing
 
How Marketo Uses Marketo
How Marketo Uses MarketoHow Marketo Uses Marketo
How Marketo Uses Marketo
 
Work Hacks - Productivity Hacks to Optimize Your Time & Maximize Results
Work Hacks - Productivity Hacks to Optimize Your Time & Maximize ResultsWork Hacks - Productivity Hacks to Optimize Your Time & Maximize Results
Work Hacks - Productivity Hacks to Optimize Your Time & Maximize Results
 
The Pavallion Dharamshala by HPCA
The Pavallion Dharamshala by HPCAThe Pavallion Dharamshala by HPCA
The Pavallion Dharamshala by HPCA
 
Reformas Loema – ¿Cómo trabajamos?
Reformas Loema – ¿Cómo trabajamos?Reformas Loema – ¿Cómo trabajamos?
Reformas Loema – ¿Cómo trabajamos?
 
BGB Construction (Pty) Ltd Profile
BGB Construction (Pty) Ltd   ProfileBGB Construction (Pty) Ltd   Profile
BGB Construction (Pty) Ltd Profile
 
DESBRAVADORES INSTRUTOR DE ESPECIALIDADES
DESBRAVADORES INSTRUTOR DE ESPECIALIDADESDESBRAVADORES INSTRUTOR DE ESPECIALIDADES
DESBRAVADORES INSTRUTOR DE ESPECIALIDADES
 
Nuclear power station Energy
Nuclear power station EnergyNuclear power station Energy
Nuclear power station Energy
 
Socceroos
SocceroosSocceroos
Socceroos
 
Resultados de Declaración de la Renta 2016 (IRPF 2015)
Resultados de Declaración de la Renta 2016 (IRPF 2015)Resultados de Declaración de la Renta 2016 (IRPF 2015)
Resultados de Declaración de la Renta 2016 (IRPF 2015)
 
Explaining Net Neutrality in less than 10 minutes
Explaining Net Neutrality in less than 10 minutesExplaining Net Neutrality in less than 10 minutes
Explaining Net Neutrality in less than 10 minutes
 

Similar to Migrating From Angular 1.x to Angular 2+

Angular js slides
Angular js slidesAngular js slides
Angular js slides
Amr Abd El Latief
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
Oswald Campesato
 
Angularjs
AngularjsAngularjs
Angularjs
Ynon Perek
 
Ng-init
Ng-init Ng-init
Ng-init
Hamdi Hmidi
 
Ng-init
Ng-init Ng-init
Ng-init
Hamdi Hmidi
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
Johannes Weber
 
Ruby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapRuby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter Bootstrap
Marcio Marinho
 
AngularJS
AngularJSAngularJS
AngularJS
AngularJS AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
AngularJS 1.x training
AngularJS 1.x trainingAngularJS 1.x training
AngularJS 1.x training
Roberto Ramadhin
 
Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
Mario Romano
 
AngularJS 101
AngularJS 101AngularJS 101
AngularJS 101
Houssem Yahiaoui
 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
Peter Drinnan
 
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
Matt Raible
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
aortbals
 
Angular from a Different Angle
Angular from a Different AngleAngular from a Different Angle
Angular from a Different Angle
Jeremy Likness
 
Angular js
Angular jsAngular js
Angular js
Thyda Eng
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
climboid
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Community
 

Similar to Migrating From Angular 1.x to Angular 2+ (20)

Angular js slides
Angular js slidesAngular js slides
Angular js slides
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Angularjs
AngularjsAngularjs
Angularjs
 
Ng-init
Ng-init Ng-init
Ng-init
 
Ng-init
Ng-init Ng-init
Ng-init
 
The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5The evolution of Angular 2 @ AngularJS Munich Meetup #5
The evolution of Angular 2 @ AngularJS Munich Meetup #5
 
Ruby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter BootstrapRuby on Rails + AngularJS + Twitter Bootstrap
Ruby on Rails + AngularJS + Twitter Bootstrap
 
AngularJS
AngularJSAngularJS
AngularJS
 
AngularJS
AngularJS AngularJS
AngularJS
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
AngularJS 1.x training
AngularJS 1.x trainingAngularJS 1.x training
AngularJS 1.x training
 
Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
 
AngularJS 101
AngularJS 101AngularJS 101
AngularJS 101
 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
 
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
The Ultimate Getting Started with Angular Workshop - Devoxx France 2017
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
 
Angular from a Different Angle
Angular from a Different AngleAngular from a Different Angle
Angular from a Different Angle
 
Angular js
Angular jsAngular js
Angular js
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
 

Recently uploaded

Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
jpupo2018
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 

Recently uploaded (20)

Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 

Migrating From Angular 1.x to Angular 2+

Editor's Notes

  1. Welcome to this webinar on how to migrate from Angular 1
  2. Specifically this is going to cover a technique that I used with my clients, those who really can’t use the word big bang. When I use the word “big bang” i mean a re-write from scratch approach. Either tools down and everyone chips in, no other work gets done approach. Or a parallel project and trying to keep worked synced between the two.
  3. As anyone who’s tried to do a big bang upgrade before knows it’s always a lot more complex and risky than you thought at first. iterative step by step approach at each stage you have a releasable product.
  4. How is this structured? First the theory behind what we are doing, the mental model. Then i’ll describe the plan, something pretty generic that you can apply to your projects. Then we’ll dive in with a real case study. Now this is a workshop that I do that takes a whole day, so we can’t cover all it in the hour. - I am going to cover the highlights. I am going to show you snippets of code but i’m not going to write any, there just isn’t time and too much to get through. You will get a copy of this video after the webinar finishes so don’t worry. And i’ll send out source code for the project as well so you can dig into the details.
  5. To get the most out of this you will be someone who AngularJS ES6 & TypeScript Angular
  6. My name is Asim, I run codecraft.tv where I do consulting and training on Angular and JS.
  7. I recently released a book on Angular 2 called Angular 2: From Theory to Practice. It was funded by Kickstarter so is FREE You can find it on Amazon, iBooks The best place to read it is via my website, there are accompanying videos and that gets updated much much faster than the other stores. So you’ve got no excuse really to not learn Angular 2!
  8. First a word mapping!
  9. Demo the contacts application
  10. Demo the contacts application
  11. Demo the contacts application
  12. Demo the contacts application
  13. Demo the contacts application
  14. Demo the contacts application
  15. Demo the contacts application
  16. When i mention an entity, i mean a comonent, service, filter, pipe, controller… a single thing in the app.
  17. [WALK AND TALK] Upgrading is the process of just increasing the version number of your application. Migrating is the process of updating your application step by step from one version to the next. One doesn’t imply the other, a migration is a slow, iterative, careful upgrade, an upgrade isn’t necessarily a migration. For example you upgrade your operating system, if half the apps break during the upgrade tough shit, nothing works, the app is unusable until you find an answer. With migration You always working on one code base. You always have a releasable app.
  18. STEP DEMO Demo App Describe the different entities
  19. So i was practising this with my girl friend and afterwards she said she doesn’t think i know what a mental model really is? But i reckon i know..
  20. [WALK AND TALK] This is a simplified view of our app Some top level directives/controllers which consume other directives/controllers and perhaps some services
  21. While migrating we run both Angular 1 and Angular 2 in the same application! We call this a Hybrid application. So yeah, during the process of migration your users will have to download both but that’s the price you’ll have to pay.
  22. Notice the EDIT and SERVICE (they have animations) In a hybrid application some entities can be written in Angular 2 and some in Angular 1. They work together and the application still runs.
  23. The question is… Is Angular 1 running inside Angular 2? Is Angular 2 running inside Angular 1? Angular 1 is always bootstrapped first and owns the bottom most view.
  24. Who is pretty comfortable with their knowledge of Zones? The new application is running in Angular 2+ zone, and therefore it no longer needs calls to $apply().
  25. The second mental model is that it’s a cross dresser.
  26. We have a 1 entity and a 2 entity. They both wear different clothes. They don’t see each other. So what we can do is we can upgrade 1 downgrade 2 Now an upgraded 1 can be used in an 2 entity or a 1 entity or even an upgraded 2 entity. [WALK AND TALK] Same goes for a downgraded Angular entity
  27. [WALK AND TALK] DI also still works. We can have a downgraded Angular 2 service that’s injected into a 2 or 1 entity. It’s also the same instance, so any data you set will be visible from the other entity
  28. The final mental model
  29. Each HTML node can only belong to either Angular 1 or Angular 2 Example above the nodes are all controlled by Angular 1 Our goal therefore is to slowly transform all the entities to Angular 2. You can go at this whichever direction you want.
  30. An Angular 1 component is managed by Angular 1 and only knows Angular 1. So if we tried to insert an Angular 2 entity into an Angular 1 entity It wouldn’t blow up, the Angular 1 component just doesn’t know what card is so ignores it.
  31. Downgrade it. Wrapped in Angular 1 clothing Still an Angular 2 component Therefore it doesn’t see the Spinner control Just like before that gets ignored!
  32. So what we do is upgrade the spinner control We wrap it in Angular 2 clothes so it can be recognised by Angular 2 components.
  33. Think of the process of migration like a disease.
  34. We infect an entity with Angular 2. I recommend you stat at the leaves. Downgrade
  35. Then we slowly spread up the app. NOTICE we only need to downgrade the component that is being used by a 1 entity.
  36. Then we spread up.
  37. And up
  38. And UP
  39. Until eventually we’ve spread everywhere…
  40. And then we get rid of 1
  41. So everything is not all rosy
  42. Not everything in Angular 1 can be migrated to Angular 2 Some things have to be re-written Filters can’t be migrated. Directives w/out templates and other features will need to be re-written.
  43. What do I mean by a component? Introduced in Angular 1.5 They are like a simplified and restricted version of a directive. They are also a core part of Angular 2. So moving to components now will make moving to Angular components in the future much easier. Flip between step 1 and step 5 SHOW: ui-router config SHOW: controller -> component config SHOW: directives -> component NOTE: Show $ctrl as syntax
  44. Start with the router since those are typically the top level nodes in your application, you don’t have to but I find it’s a good place to start.
  45. DEMO Flip from step 1 to step 5 Show router config for person list. Show code for person list component. Show code for spinner directive.
  46. Converted all. STILL RUNNING ANGULAR 1 Have some fun! - Lets now start having some fun, es6’ify your app (or typescriptifying depending on how far you take it). Use ES6 contstructs, classes, learn destructing, fat arrow syntax etc..
  47. A great place to start is the services. Angular 1 services written as ES6 classes are very easy to migrate to Angular 2.
  48. There is no $resource in Angular 2 There is the Http module which looks very much like the Angular 1 $http module. So spend this time to migrate away from $resource to $http.
  49. There is no $q in Angular 2 So maybe spend this time re-writing to use the new ES6 Promise syntax.
  50. Since ES6 classes are just constructor functions. And services in Angular 1 are also just constructor functions and also map to Angular 2 services much better. Spend this time to also move from using factory to service.
  51. DEMO Flip from step 1 to step 5 SHOW: Contact Resource SHOW: Contact Service
  52. Now we’ve done all the prep work we are ready for the actual migrate. We just include Angular 2 Create our main AppModule and then instead of bootstrapping that directly we duel boot with both Angular 1 and Angular 2.
  53. All we are doing is adding Angular to our application.
  54. We are now here. A duel booted Angular 1 + 2 application, but all of the components/directives/services are all still Angular 1.
  55. A great place to start is the services. Angular 1 services written as ES6 classes are very easy to migrate to Angular 2.
  56. Show main.ts
  57. It’s far easier in my opinion to just go bottom up. Convert the leaves to Angular 2 and then move up the tree. Services are going to be shared by lots of different things in our app so it makes sense to migrate those to Angular 2 first. Thankfully due to our prep it’s going to be pretty easy.
  58. Going back to our diagram we’ve got two services, ContactService ContactResource Going to migrate ContactService to Angular 2 and then downgrade it so it can be used in Angular 1 and since Resource is only going to be used by an Angular 2 service we migrate it to Angular 2 and don’t need to downgrade it. DEMO Step-7 <> Step-6
  59. When faced with a 3rd party Angular 1 service Re-write to Angular 2+ yourself Find an Angular 2+ version Upgrade to Angular 2+
  60. ContactService Compare Step 6 to Step 7 NOTICE: @Injectable() NgModule downgradeInjectable We still have our angular 1 module config at the bottom, but we add to our Angular 1 config a downgraded version of this service. This is what makes our ContactService usable from both an Angular 1 and an Angular 2 entity. NOTICE AGAIN: Toaster It’s not in the diagram to save space but the ContactService also relies on a 3rd party Angular 1 service called toaster? We don’t control toaster, we can migrate it - so how do we make it injectable into an Angular 2 service? We can try to write our own? We can try to find if there is a 3rd party Angular 2 version? We can upgrade an angular 1 service to use in an Angular 2 app. Eventually we’ll have to figure out a solution, we can’t drop Angular 1 till we figure out a solution but for now we can use upgrade. We can Upgrade an Angular 1 service to make it available in Angular 2 entity. ajs-upgraded-providers.ts Copy paste code.
  61. We are getting close people!
  62. Again start at the leaves. In this case study i started at the card and spinner components. Very similar to the services method we just migrate them to Angular 2 and then downgrade so they can be used in Angular 1.
  63. Then it’s just the grind, slowly walking up the tree. Migrating them to Angular 2 and the downgrading them to be used in Angular 1. Most of the issues you’ll face are just about dependancies that you can’t control. Re-write Find Upgrade Most of the time you’ll want to opt for the second two, since the goal is to get rid of Angular 1.
  64. DEMO Start with spinner It’s the simplest - show step 7 Show how it’s used with inputs Show bindings. Show it’s using another 3rd party module called ui-spinner Step 8 @Component Bindings -> Inputs Template, show how you now use Angular 2 syntax since it’s an Angular 2 component. downguadecomponent (Notice the bindings.) Tip! - Show how the bindings are named Angular 2 style. Still need to have [] despite being used in an Angular 1 component and STILL need to be snake-case Spinner! Same problem as the toaster. Upgrade Rewrite Look for another 3rd party module. This time i went for a re-write, not the best but essentially using the same underlying library called spin.js to load the spinner. Won’t go into depth you can look at the code and compare the branches yourself to see the changes. EditComponent - 8 -> 9 Show step-8 in the EditComponent - Old Code Show step-9 in the EditComponent - New Code Routing is the last thing we can migrate only until we have migrated everything else to Angular 2 can we even think about migrating the router to the Angular 2 router. So we have no option but to continue using the uiRouter service, but i’ve shown you how to handle this already - we simply upgrade them. Then we can use these Angular 1 services inside Angular 2
  65. Ok so we are there now
  66. I can’t figure out how to easily break this up into small steps, so I call this the tiny pop. NOT big bang.
  67. Swap out ui-router <> Angular 2 Router Add a root component
  68. TIP: If you have been using multiple named ui-views in your ui-router based application you can do the same with Angular 2 and multiple named router outlets, but depending on your use case might need some masaging.
  69. STEP-12 We replace the ui-router with the Angular router. Since we re-write the ui-router to use component this should be fairly simple. Angular 2 has a root component, we add the code that used to be in index.html into that component and we make it hold the router outlets and the new router directives.
  70. Find solutions to all the upgraded Angular 1 entities that you used. For my demo app it’s actually the Toaster which we upgraded, in the end I found an Angular 2 one on the internet. Basically remove all the old code. Make sure you remove all the code referring to Angular 1 otherwise your build tools might pull that code it and bundle it with yours. Now you are running a fun Angular 2 application! Remove AngularJS which means Replacing remove final set of upgraded ng1 services/components (toaster)