Slide 1

Slide 1 text

ngular with Minko Gechev github.com/mgechev twitter.com/mgechev blog.mgechev.com Integrated Web Stack with

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

agenda

Slide 5

Slide 5 text

What is Angular 2

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Mobile • Web apps • Ionic 2 • NativeScript • React Native

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Desktop • Web apps • Electron

Slide 11

Slide 11 text

Angular 2 is platform agnostic

Slide 12

Slide 12 text

core (zones, di, abstractions, etc.)

Slide 13

Slide 13 text

renderer core (zones, di, abstractions, etc.)

Slide 14

Slide 14 text

compiler renderer core (zones, di, abstractions, etc.)

Slide 15

Slide 15 text

http compiler renderer core (zones, di, abstractions, etc.)

Slide 16

Slide 16 text

forms http compiler renderer core (zones, di, abstractions, etc.)

Slide 17

Slide 17 text

forms http compiler renderer core (zones, di, abstractions, etc.) router

Slide 18

Slide 18 text

forms http compiler renderer core (zones, di, abstractions, etc.) router i18n

Slide 19

Slide 19 text

forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade

Slide 20

Slide 20 text

forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 21

Slide 21 text

PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 22

Slide 22 text

Universal PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 23

Slide 23 text

material 2 Universal PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 24

Slide 24 text

CLI material 2 Universal PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 25

Slide 25 text

language services CLI material 2 Universal PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 26

Slide 26 text

angularfire2 language services CLI material 2 Universal PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 27

Slide 27 text

angularfire2 language services CLI material 2 Universal PWA forms http compiler renderer core (zones, di, abstractions, etc.) router i18n ngUpgrade animations

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Angular 2’s Core

Slide 30

Slide 30 text

Core • Zone.js • Ultrafast Change Detection • Dependency Injection • View Encapsulation

Slide 31

Slide 31 text

“A Zone is an execution context that persists across async tasks. You can think of it as thread-local storage for JavaScript VMs.”

Slide 32

Slide 32 text

“A Zone is an execution context that persists across async tasks. You can think of it as thread-local storage for JavaScript VMs.”

Slide 33

Slide 33 text

@Component(...) class SimpleComponent { getData() { fetch('https://example.com/data.json') .then(response => response.json()) .then(data => { this.users = data; this.cd.detectChanges(); }); } } no-zones.js

Slide 34

Slide 34 text

@Component(...) class SimpleComponent { getData() { fetch('https://example.com/data.json') .then(response => response.json()) .then(data => { this.users = data; this.cd.detectChanges(); }); } } no-zones.js

Slide 35

Slide 35 text

with-zones.js @Component(...) class SimpleComponent { getData() { fetch('https://example.com/data.json') .then(response => response.json()) .then(data => this.users = data); } }

Slide 36

Slide 36 text

in-zones.js const old = Promise.prototype.then; Promise.prototype.then = function () { old.apply(Promise.prototype, arguments); this.rootCD.detectChanges(); };

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

Renderer

Slide 41

Slide 41 text

“A set of abstract operations which can be specialized for a specific platform”

Slide 42

Slide 42 text

“A set of abstract operations which can be specialized for a specific platform”

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Client Server

Slide 45

Slide 45 text

Client Server

Slide 46

Slide 46 text

Client Server GET / GET * loop

Slide 47

Slide 47 text

Client Server GET / GET * loop Running JavaScript

Slide 48

Slide 48 text

Client Server GET / GET * loop GET * loop

Slide 49

Slide 49 text

Client Server GET / GET * loop GET * loop

Slide 50

Slide 50 text

server-side rendering

Slide 51

Slide 51 text

Client Server

Slide 52

Slide 52 text

Client Server

Slide 53

Slide 53 text

Client Server GET /

Slide 54

Slide 54 text

Client Server GET / Running JavaScript

Slide 55

Slide 55 text

Client Server GET / GET * loop

Slide 56

Slide 56 text

Client Server GET / GET * loop Running JavaScript

Slide 57

Slide 57 text

Client Server GET / GET * loop

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

“NativeScript 2.0 truly native mobile apps”

Slide 60

Slide 60 text

“NativeScript 2.0 truly native mobile apps”

Slide 61

Slide 61 text

why not…

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Compiler

Slide 64

Slide 64 text

“Compiles your templates to JavaScript calls to the renderer”

Slide 65

Slide 65 text

template.html

Howdy! Here's a list

...

Slide 66

Slide 66 text

compiled.js ... var parentRenderNode = renderer .createViewRoot(declarationAppElement.nativeElement); _el_0 = renderer .createElement(parentRenderNode,'p',debug(0,0,0)); _text_1 = renderer .createText(_el_0,'\n Howdy! Here\'s a list',debug(1,0,3)); _text_2 = renderer .createText(parentRenderNode,'\n\n',debug(2,3,4)); _el_3 = renderer .createElement(parentRenderNode,'form',debug(3,5,0)); ...

Slide 67

Slide 67 text

Compiler works run-time and build time

Slide 68

Slide 68 text

Single instance of the renderer

Slide 69

Slide 69 text

Optimizations • Payload reduction (tree-shaking) • Pre-compilation • Ultra-fast change detection • WebWorkers

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

angular/mobile-toolkit

Slide 74

Slide 74 text

Progressive enhancement for web applications

Slide 75

Slide 75 text

mobile-toolkit • Offline access to static content • Notifications for new versions • Efficient download of deltas • Support of push notifications • AppShell

Slide 76

Slide 76 text

Service Workers and AppCache

Slide 77

Slide 77 text

AppCache Service Workers AppCache Service Workers

Slide 78

Slide 78 text

AppCache Service Workers = ~91.8%

Slide 79

Slide 79 text

Development experience

Slide 80

Slide 80 text

Typical JavaScript experience

Slide 81

Slide 81 text

Angular is… • Built with TypeScript • Compile-time type checking • Great IDE/text editors support • Analyzable templates

Slide 82

Slide 82 text

Type-checking and IntelliSense in templates

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

Already supported by some IDEs

Slide 87

Slide 87 text

Still immature…

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

Using style guide in your project

Slide 92

Slide 92 text

Enforcing common style

Slide 93

Slide 93 text

• Fork the official style guide • Modify the styles according to your needs • Introduce the style guide to your team • Verify that each individual code change follows it Enforcing common style

Slide 94

Slide 94 text

• Fork the official style guide • Modify the styles according to your needs • Introduce the style guide to your team • Verify that each individual code change follows it Enforcing common style

Slide 95

Slide 95 text

• Fork the official style guide • Modify the styles according to your needs • Introduce the style guide to your team • Verify that each individual code change follows it Enforcing common style

Slide 96

Slide 96 text

Code review process

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

manual boring error-prone

Slide 99

Slide 99 text

codelyzer

Slide 100

Slide 100 text

“codelyzer is a project which aims to enforce common style and verify correctness of your program”

Slide 101

Slide 101 text

No content

Slide 102

Slide 102 text

Where to start?

Slide 103

Slide 103 text

angular-cli

Slide 104

Slide 104 text

ng new hello-world

Slide 105

Slide 105 text

angular-cli: • Quick bootstrap of projects • Generating: • Components • Services • Directives • Pipes • Support for offline apps • many others…

Slide 106

Slide 106 text

angular2-seed

Slide 107

Slide 107 text

angular2-seed • TypeScript transpilation • Statically typed dev and prod builds • Out of the box unit-testing • Test coverage • e2e testing with protractor • Static code analyzer

Slide 108

Slide 108 text

Resources: • angular.io • github.com/angular/angular • github.com/angular/mobile-toolkit • github.com/angular/angular-cli • github.com/mgechev/angular2-seed

Slide 109

Slide 109 text

Thank you! github.com/mgechev twitter.com/mgechev blog.mgechev.com