SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Whoami?
• Tony May @_tonymay
• Founded my own agency to act as a technical co-
founder for startups (Primary stack ng1 + ng-
material + ionic)
• Some corporate consulting Like William Hill (a
crazy hybrid 50% iOS + 50% ionic = 110%
awesome)
• Currently working at identitii – startup working
on blockchain (Ethereum) POCs for
correspondent banks (Ng1/2 + Ng Material, Node
& Golang)
From Ng1 to Ng2 (and beyond)
• Step 1: Javascript -> Typescript
• Step 2: Grunt/Gulp -> Webpack
• Step 3: Ng2 Bootstrapping
• Step 4: Decide on Strategy
(inside out vs outside in)
• Step 5: Optimise + Minimise
A note on comparisons
False dichotomy: a logical fallacy which involves
presenting two opposing views, options or
outcomes in such a way that they seem to be
the only possibilities: that is, if one is true, the
other must be false, or, more typically, if you do
not accept one then the other must be
accepted. The reality in most cases is that there
are many in-between or other alternative
options, not just two mutually exclusive ones.
From Ng1 to Ng2 (and beyond)
• Step 1: Javascript -> Typescript
• Step 2: Grunt/Gulp -> Webpack
• Step 3: Ng2 Bootstrapping
• Step 4: Decide on Strategy
(inside out vs outside in)
• Step 5: Optimise + Minimise
Steps to implement
• tsconfig
• npm
• typings for existing
dependencies
• choose your output
directory
• rename *.js -> *.ts
• sudo rm -rf /
Step 1: Javascript -> Typescript
Why: It’s a SUPERset ;-) of javascript
Why: Interfaces are awesome (refactor like a boss)
To ng2 (beyond)
• Step 1: Javascript -> Typescript
• Step 2: Grunt/Gulp -> Webpack
• Step 3: Ng2 Bootstrapping
• Step 4: Decide on Strategy
(inside out vs outside in)
• Step 5: Optimise + Minimise
Primarily: A different philosophy
Angular
• .config()
• .decorate()
• .$broadcast
Angular 2
• Pre-compile via packager
• Pre-compile via packager
• RXJS LIKE A BOSS!
Step 2: Bower -> Npm
Why: does everything bower does + more
Why: Seems like everyone is now on-board the npm train
Build Pipeline
Angular
1. Packages: Bower
2. Build: Grunt/Gulp
3. Javascript
4. JSLint
5. Write Code
6. Package
7. Optimise/Minimise
Angular 2
1. Packages: Npm
2. Build: Webpack
3. Typescript
4. Typings
5. Package/Transpile
6. Write Code
7. Optimise/Minimise
From Ng1 to Ng2 (and beyond)
• Step 1: Javascript -> Typescript
• Step 2: Grunt/Gulp -> Webpack
• Step 3: Ng2 Bootstrapping
• Step 4: Decide on Strategy
(inside out vs outside in)
• Step 5: Optimise + Minimise
Angular1 with Angular2 Angular2 with Angular1
Summary
• ForwardRef is necessary, and you will have a
big pita if you try and use export with the
Upgrade Adapter
• The debugging is sometimes tricky, especially
when you have multiple frameworks nested
• The Ng1 & Ng2 types are IN THE METHOD
NAME!!
• app(‘main’).factory(‘blah’,
downgradeNg2Provider(Ng2Provider))
To ng2 (beyond)
• Step 1: Javascript -> Typescript
• Step 2: Grunt/Gulp -> Webpack
• Step 3: Ng2 Bootstrapping
• Step 4: Decide on Strategy
(inside out vs outside in)
• Step 5: Optimise + Minimise
I Can Has?
• Ng1 with Ng2 children? Yes
• Ng2 with Ng1 children? Yes
• Ng1 with Ng2 children, with Ng1 children?
Probably not
• Ng2 with Ng1 children, with Ng2 children?
Probably not
• $broadcast? Hell no, use observables!! 
Main
Component
(w router)
Search View Detail View
Button
Predictive
Search
Menu
Hero
Provider
Example Application Structure
Main
Component
(w router)
Search View Detail View
Button
Predictive
Search
Menu
Hero
Provider
Outside In Upgrade
2
3
1
Main
Component
(w router)
Search View Detail View
Button
Predictive
Search
Menu
Hero
Provider
Inside Out Upgrade
32
1
Mistakes, I had had my few
• Tried outside in to start, with my angular material
Ng1 app, OMG, DO NOT DO THIS. When I first
tried this, it was not rendering, not giving a
console message, so I had use the force to debug
• Didn’t know about observables so I implemented
ng-redux to replace a component that relied on
$rootScope.$broadcast :-P and had to change
everything back once I worked out observables
• Thinking you could just “drop in” Angular 1
components, I wish it was that simple.
To Ng2 (and beyond)
• Step 1: Javascript -> Typescript
• Step 2: Grunt/Gulp -> Webpack
• Step 3: Ng2 Bootstrapping
• Step 4: Decide on Strategy
(inside out vs outside in)
• Step 5: Optimise + Minimise
Out of TIME!
• Basically, the new html syntax can have some issues with webpack 2 beta
gulification, uguficaltoin, uglification. I’ve found that webpack 1 is
currently better because you get a smaller bundle size, and better
transpile support (espeically if you use Google Closure Compilier)
• You get the best result if you cherry pick the includes, (e.g.
// Only import the rxjs bits that you need
import 'rxjs/Observable’;
import 'rxjs/add/operator/toPromise’;
import 'rxjs/add/operator/map’;
import 'rxjs/Subject’;
import 'rxjs/BehaviorSubject’;
) then rely on the CommonsChunk webpack plugin to… well..
chunk the common libraries.
• Final size is super important, imho you will need to include Ng2+Rx
(~140kB min+compress) Ng1 (~50kB min+compress) + other libraries so
you need to get the final bundle as small as possible.
• I’ll post some code examples of each step on github, on Friday!
• Join the telegram group, I’m happy to answer any questions you have!
https://telegram.me/joinchat/DhJ-lgmRdB-mkBh5Nk6GHQ

Weitere ähnliche Inhalte

Ähnlich wie From Angular to Angular 2 via the UpgradeAdapter

Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perlDean Hamstead
 
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - PanoraysHacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - PanoraysDemi Ben-Ari
 
Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better SoftwareHean Hong Leong
 
Taking the plunge: Why you should use new technology on client projects
Taking the plunge: Why you should use new technology on client projectsTaking the plunge: Why you should use new technology on client projects
Taking the plunge: Why you should use new technology on client projectsTommy Ferry
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneDavid Glick
 
Writing a Ruby Gem for beginners
Writing a Ruby Gem for beginnersWriting a Ruby Gem for beginners
Writing a Ruby Gem for beginnersConFoo
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsPerforce
 
Devops Devops Devops, at Froscon
Devops Devops Devops, at FrosconDevops Devops Devops, at Froscon
Devops Devops Devops, at FrosconKris Buytaert
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpAhmed Abdou
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Mozaic Works
 
It's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypesIt's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypesPhilip Bauer
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)Wilfried Schobeiri
 
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...Tsundere Chen
 
Zope is dead - Long live Zope
Zope is dead - Long live ZopeZope is dead - Long live Zope
Zope is dead - Long live ZopeLennart Regebro
 

Ähnlich wie From Angular to Angular 2 via the UpgradeAdapter (20)

Getting big without getting fat, in perl
Getting big without getting fat, in perlGetting big without getting fat, in perl
Getting big without getting fat, in perl
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
Git sourcecontrolpreso
Git sourcecontrolpresoGit sourcecontrolpreso
Git sourcecontrolpreso
 
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - PanoraysHacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
Hacking for fun & profit - The Kubernetes Way - Demi Ben-Ari - Panorays
 
Developing Better Software
Developing Better SoftwareDeveloping Better Software
Developing Better Software
 
Taking the plunge: Why you should use new technology on client projects
Taking the plunge: Why you should use new technology on client projectsTaking the plunge: Why you should use new technology on client projects
Taking the plunge: Why you should use new technology on client projects
 
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting PloneWhen Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
When Good Code Goes Bad: Tools and Techniques for Troubleshooting Plone
 
Android Performance Tips
Android Performance TipsAndroid Performance Tips
Android Performance Tips
 
Intro to Gulp
Intro to GulpIntro to Gulp
Intro to Gulp
 
Writing a Ruby Gem for beginners
Writing a Ruby Gem for beginnersWriting a Ruby Gem for beginners
Writing a Ruby Gem for beginners
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and Economics
 
Devops Devops Devops, at Froscon
Devops Devops Devops, at FrosconDevops Devops Devops, at Froscon
Devops Devops Devops, at Froscon
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
 
Front-End Tooling
Front-End ToolingFront-End Tooling
Front-End Tooling
 
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
 
It's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypesIt's the way of the present - Why you should use plone.app.contenttypes
It's the way of the present - Why you should use plone.app.contenttypes
 
How go makes us faster (May 2015)
How go makes us faster (May 2015)How go makes us faster (May 2015)
How go makes us faster (May 2015)
 
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
PyCon TW 2017 - PyPy's approach to construct domain-specific language runtime...
 
Zope is dead - Long live Zope
Zope is dead - Long live ZopeZope is dead - Long live Zope
Zope is dead - Long live Zope
 
Old Dogs and New Tricks
Old Dogs and New TricksOld Dogs and New Tricks
Old Dogs and New Tricks
 

Kürzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

From Angular to Angular 2 via the UpgradeAdapter

  • 1. Whoami? • Tony May @_tonymay • Founded my own agency to act as a technical co- founder for startups (Primary stack ng1 + ng- material + ionic) • Some corporate consulting Like William Hill (a crazy hybrid 50% iOS + 50% ionic = 110% awesome) • Currently working at identitii – startup working on blockchain (Ethereum) POCs for correspondent banks (Ng1/2 + Ng Material, Node & Golang)
  • 2. From Ng1 to Ng2 (and beyond) • Step 1: Javascript -> Typescript • Step 2: Grunt/Gulp -> Webpack • Step 3: Ng2 Bootstrapping • Step 4: Decide on Strategy (inside out vs outside in) • Step 5: Optimise + Minimise
  • 3. A note on comparisons False dichotomy: a logical fallacy which involves presenting two opposing views, options or outcomes in such a way that they seem to be the only possibilities: that is, if one is true, the other must be false, or, more typically, if you do not accept one then the other must be accepted. The reality in most cases is that there are many in-between or other alternative options, not just two mutually exclusive ones.
  • 4. From Ng1 to Ng2 (and beyond) • Step 1: Javascript -> Typescript • Step 2: Grunt/Gulp -> Webpack • Step 3: Ng2 Bootstrapping • Step 4: Decide on Strategy (inside out vs outside in) • Step 5: Optimise + Minimise
  • 5. Steps to implement • tsconfig • npm • typings for existing dependencies • choose your output directory • rename *.js -> *.ts • sudo rm -rf / Step 1: Javascript -> Typescript Why: It’s a SUPERset ;-) of javascript Why: Interfaces are awesome (refactor like a boss)
  • 6.
  • 7. To ng2 (beyond) • Step 1: Javascript -> Typescript • Step 2: Grunt/Gulp -> Webpack • Step 3: Ng2 Bootstrapping • Step 4: Decide on Strategy (inside out vs outside in) • Step 5: Optimise + Minimise
  • 8. Primarily: A different philosophy Angular • .config() • .decorate() • .$broadcast Angular 2 • Pre-compile via packager • Pre-compile via packager • RXJS LIKE A BOSS! Step 2: Bower -> Npm Why: does everything bower does + more Why: Seems like everyone is now on-board the npm train
  • 9. Build Pipeline Angular 1. Packages: Bower 2. Build: Grunt/Gulp 3. Javascript 4. JSLint 5. Write Code 6. Package 7. Optimise/Minimise Angular 2 1. Packages: Npm 2. Build: Webpack 3. Typescript 4. Typings 5. Package/Transpile 6. Write Code 7. Optimise/Minimise
  • 10.
  • 11. From Ng1 to Ng2 (and beyond) • Step 1: Javascript -> Typescript • Step 2: Grunt/Gulp -> Webpack • Step 3: Ng2 Bootstrapping • Step 4: Decide on Strategy (inside out vs outside in) • Step 5: Optimise + Minimise
  • 12.
  • 13. Angular1 with Angular2 Angular2 with Angular1
  • 14. Summary • ForwardRef is necessary, and you will have a big pita if you try and use export with the Upgrade Adapter • The debugging is sometimes tricky, especially when you have multiple frameworks nested • The Ng1 & Ng2 types are IN THE METHOD NAME!! • app(‘main’).factory(‘blah’, downgradeNg2Provider(Ng2Provider))
  • 15. To ng2 (beyond) • Step 1: Javascript -> Typescript • Step 2: Grunt/Gulp -> Webpack • Step 3: Ng2 Bootstrapping • Step 4: Decide on Strategy (inside out vs outside in) • Step 5: Optimise + Minimise
  • 16. I Can Has? • Ng1 with Ng2 children? Yes • Ng2 with Ng1 children? Yes • Ng1 with Ng2 children, with Ng1 children? Probably not • Ng2 with Ng1 children, with Ng2 children? Probably not • $broadcast? Hell no, use observables!! 
  • 17. Main Component (w router) Search View Detail View Button Predictive Search Menu Hero Provider Example Application Structure
  • 18. Main Component (w router) Search View Detail View Button Predictive Search Menu Hero Provider Outside In Upgrade 2 3 1
  • 19. Main Component (w router) Search View Detail View Button Predictive Search Menu Hero Provider Inside Out Upgrade 32 1
  • 20. Mistakes, I had had my few • Tried outside in to start, with my angular material Ng1 app, OMG, DO NOT DO THIS. When I first tried this, it was not rendering, not giving a console message, so I had use the force to debug • Didn’t know about observables so I implemented ng-redux to replace a component that relied on $rootScope.$broadcast :-P and had to change everything back once I worked out observables • Thinking you could just “drop in” Angular 1 components, I wish it was that simple.
  • 21. To Ng2 (and beyond) • Step 1: Javascript -> Typescript • Step 2: Grunt/Gulp -> Webpack • Step 3: Ng2 Bootstrapping • Step 4: Decide on Strategy (inside out vs outside in) • Step 5: Optimise + Minimise
  • 22. Out of TIME! • Basically, the new html syntax can have some issues with webpack 2 beta gulification, uguficaltoin, uglification. I’ve found that webpack 1 is currently better because you get a smaller bundle size, and better transpile support (espeically if you use Google Closure Compilier) • You get the best result if you cherry pick the includes, (e.g. // Only import the rxjs bits that you need import 'rxjs/Observable’; import 'rxjs/add/operator/toPromise’; import 'rxjs/add/operator/map’; import 'rxjs/Subject’; import 'rxjs/BehaviorSubject’; ) then rely on the CommonsChunk webpack plugin to… well.. chunk the common libraries. • Final size is super important, imho you will need to include Ng2+Rx (~140kB min+compress) Ng1 (~50kB min+compress) + other libraries so you need to get the final bundle as small as possible. • I’ll post some code examples of each step on github, on Friday! • Join the telegram group, I’m happy to answer any questions you have! https://telegram.me/joinchat/DhJ-lgmRdB-mkBh5Nk6GHQ