86
How to migrate from AngularJS

Migrating from AngularJS when you can't use the word "Big Bang@

Embed Size (px)

Citation preview

Page 1: Migrating from AngularJS when you can't use the word "Big Bang@

How to migrate from AngularJS

Page 2: Migrating from AngularJS when you can't use the word "Big Bang@
Page 3: Migrating from AngularJS when you can't use the word "Big Bang@

When you can’t use the word “Big Bang”

Page 4: Migrating from AngularJS when you can't use the word "Big Bang@

?

Page 5: Migrating from AngularJS when you can't use the word "Big Bang@

How is this structured?

Page 6: Migrating from AngularJS when you can't use the word "Big Bang@

• Mental Model• Plan• Case Study

How is this structured?

Page 7: Migrating from AngularJS when you can't use the word "Big Bang@

https://github.com/codecraftpro/angularjs-migration-workshop

How is this structured?

Page 8: Migrating from AngularJS when you can't use the word "Big Bang@

Who am I?

Page 9: Migrating from AngularJS when you can't use the word "Big Bang@
Page 11: Migrating from AngularJS when you can't use the word "Big Bang@

Angular:From Theory to Practice

angular.codecraft.tv

Kickstarter Funded - FREE

angular.codecraft.tv — @jawache

Page 12: Migrating from AngularJS when you can't use the word "Big Bang@

Terminology

angular.codecraft.tv — @jawache

Page 13: Migrating from AngularJS when you can't use the word "Big Bang@

Angular = Angular 4+

angular.codecraft.tv — @jawache

Page 14: Migrating from AngularJS when you can't use the word "Big Bang@

AngularJS = Angular 1.x

angular.codecraft.tv — @jawache

Page 15: Migrating from AngularJS when you can't use the word "Big Bang@

Filters = Pipes

angular.codecraft.tv — @jawache

Page 16: Migrating from AngularJS when you can't use the word "Big Bang@

Controllers = Components

angular.codecraft.tv — @jawache

Page 17: Migrating from AngularJS when you can't use the word "Big Bang@

Directives + HTML = Components

angular.codecraft.tv — @jawache

Page 18: Migrating from AngularJS when you can't use the word "Big Bang@

Directives - HTML = Directives

angular.codecraft.tv — @jawache

Page 19: Migrating from AngularJS when you can't use the word "Big Bang@

Service/Factory = Service

angular.codecraft.tv — @jawache

Page 20: Migrating from AngularJS when you can't use the word "Big Bang@

Entity?

angular.codecraft.tv — @jawache

Page 21: Migrating from AngularJS when you can't use the word "Big Bang@

Angular is BLUEAngularJS is RED

angular.codecraft.tv — @jawache

Page 22: Migrating from AngularJS when you can't use the word "Big Bang@

DEMO

Page 23: Migrating from AngularJS when you can't use the word "Big Bang@

ui-router

angular.codecraft.tv — @jawache

Page 24: Migrating from AngularJS when you can't use the word "Big Bang@

Mental Model

angular.codecraft.tv — @jawache

Page 25: Migrating from AngularJS when you can't use the word "Big Bang@

Dual Booting

angular.codecraft.tv — @jawache

Page 26: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

ResourceEdit

Create

Search

JS

angular.codecraft.tv — @jawache

Page 27: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

ResourceEdit

Create

Search

JS

4+angular.codecraft.tv — @jawache

Page 28: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

ResourceEdit

Create

Search

JS

4+angular.codecraft.tv — @jawache

Page 29: Migrating from AngularJS when you can't use the word "Big Bang@

Zones ➡ $scope.$apply(…)

angular.codecraft.tv — @jawache

Page 30: Migrating from AngularJS when you can't use the word "Big Bang@

Chameleon

angular.codecraft.tv — @jawache

Page 31: Migrating from AngularJS when you can't use the word "Big Bang@

List

List

AngularJS

DowngradedAngular

Angular

UpgradedAngularJS List ⬆

List ⬇

Page 32: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

List

Edit

Service

angular.codecraft.tv — @jawache

Page 33: Migrating from AngularJS when you can't use the word "Big Bang@

Control Freak

angular.codecraft.tv — @jawache

Page 34: Migrating from AngularJS when you can't use the word "Big Bang@

<card>

<body>

<spinner>

Page 35: Migrating from AngularJS when you can't use the word "Big Bang@

<card>

<body>

<spinner>

Page 36: Migrating from AngularJS when you can't use the word "Big Bang@

<card> ⬇

<body>

<spinner>

Page 37: Migrating from AngularJS when you can't use the word "Big Bang@

<body>

<spinner> ⬆

<card> ⬇

Page 38: Migrating from AngularJS when you can't use the word "Big Bang@

Root Component is AngularJS

angular.codecraft.tv — @jawache

Page 39: Migrating from AngularJS when you can't use the word "Big Bang@

Plague

angular.codecraft.tv — @jawache

Page 40: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

Edit

Create

Search

JS

4+

Resource ⬇

Page 41: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

ListCard

Spinner

Edit

Create

Search

JS

4+

Resource

Page 42: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

ListCard ⬇

Spinner

Edit

Create

Search

JS

4+

Resource

Page 43: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

ListCard ⬇

Spinner ⬇

Edit

Create

Search

JS

4+

Resource

Page 44: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

List ⬇Card

Spinner

Edit

Create

Search

JS

4+

Resource

Page 45: Migrating from AngularJS when you can't use the word "Big Bang@

Service

List ⬇Card

Spinner

Edit ⬇

Create ⬇

Search ⬇

JS

4+

Resource

Page 46: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

Edit

Create

Search

4+Resource

Page 47: Migrating from AngularJS when you can't use the word "Big Bang@

But…

Page 48: Migrating from AngularJS when you can't use the word "Big Bang@

• Filters• (some) Directives

Page 49: Migrating from AngularJS when you can't use the word "Big Bang@

10 Step Plan

angular.codecraft.tv — @jawache

Page 50: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular 8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 51: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 52: Migrating from AngularJS when you can't use the word "Big Bang@

Top Tips!

Page 53: Migrating from AngularJS when you can't use the word "Big Bang@

Start with the Router

angular.codecraft.tv — @jawache

Page 54: Migrating from AngularJS when you can't use the word "Big Bang@

CODE!

Page 55: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 56: Migrating from AngularJS when you can't use the word "Big Bang@

Top Tips!

Page 57: Migrating from AngularJS when you can't use the word "Big Bang@

Start with the Service/Factories

angular.codecraft.tv — @jawache

Page 58: Migrating from AngularJS when you can't use the word "Big Bang@

$resource use $http

angular.codecraft.tv — @jawache

Page 59: Migrating from AngularJS when you can't use the word "Big Bang@

.factory(..) use .service(..)

angular.codecraft.tv — @jawache

Page 60: Migrating from AngularJS when you can't use the word "Big Bang@

$q use Promise

angular.codecraft.tv — @jawache

Page 61: Migrating from AngularJS when you can't use the word "Big Bang@

angular.forEach use for…of

angular.codecraft.tv — @jawache

Page 62: Migrating from AngularJS when you can't use the word "Big Bang@

CODE!

Page 63: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 64: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

ResourceEdit

Create

Search

JS

angular.codecraft.tv — @jawache

Page 65: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

ResourceEdit

Create

Search

JS

4+angular.codecraft.tv — @jawache

Page 66: Migrating from AngularJS when you can't use the word "Big Bang@

Top Tips!

Page 67: Migrating from AngularJS when you can't use the word "Big Bang@

Remove ng-app

angular.codecraft.tv — @jawache

Page 68: Migrating from AngularJS when you can't use the word "Big Bang@

CODE!

Page 69: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular 8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 70: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

ListCard

Spinner

Edit

Create

Search

JS

4+

Resource

angular.codecraft.tv — @jawache

Page 71: Migrating from AngularJS when you can't use the word "Big Bang@

Top Tips!

Page 72: Migrating from AngularJS when you can't use the word "Big Bang@

• Re-write• Find• Upgrade

angular.codecraft.tv — @jawache

Page 73: Migrating from AngularJS when you can't use the word "Big Bang@

CODE!

Page 74: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular 8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 75: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

ListCard ⬇

Spinner ⬇

Edit

Create

Search

JS

4+

Resource

angular.codecraft.tv — @jawache

Page 76: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

List ⬇Card

Spinner

Edit

Create

Search

JS

4+

Resource

angular.codecraft.tv — @jawache

Page 77: Migrating from AngularJS when you can't use the word "Big Bang@

Service ⬇

List ⬇Card

Spinner

Edit ⬇

Create

Search

JS

4+

Resource

angular.codecraft.tv — @jawache

Page 78: Migrating from AngularJS when you can't use the word "Big Bang@

CODE!

Page 79: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual Boot7. Services to Angular8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 80: Migrating from AngularJS when you can't use the word "Big Bang@

Tiny Pop

Page 81: Migrating from AngularJS when you can't use the word "Big Bang@

• Bootstrap with Angular• Angular Router

angular.codecraft.tv — @jawache

Page 82: Migrating from AngularJS when you can't use the word "Big Bang@

CODE!

Page 83: Migrating from AngularJS when you can't use the word "Big Bang@

1. Style guide2. TypeScript & build tools3. AngularJS 1.5+4. Component’ify5. ES6’ify6. Dual boot7. Services to Angular8. Components to Angular9. Routing to Angular10.Remove AngularJS

angular.codecraft.tv — @jawache

Page 84: Migrating from AngularJS when you can't use the word "Big Bang@

Service

ListCard

Spinner

Edit

Create

Search

4+Resource

angular.codecraft.tv — @jawache

Page 85: Migrating from AngularJS when you can't use the word "Big Bang@

Finished

Page 86: Migrating from AngularJS when you can't use the word "Big Bang@

Questions?

[email protected]@jawache

github.com/jawache/ama