Slide 1

Slide 1 text

Beginner to Advanced NGULAR LIBRARY Yadong Xie Google Developer Expert Twitter: @yadong_xie

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Performance

Slide 4

Slide 4 text

Change Detection Strategy • CheckOnce Instead Of CheckAlways • https://danielwiehl.github.io/edu-angular-change-detection/ • Use markForCheck() with CheckOnce strategy • Optimize Angular's change detection • Detach Change Detector • Detach change detector to limit how often check occurs • Zone Flags • https://angular.io/guide/zone • ngZoneEventCoalescing • ngZoneRunCoalescing • ZoneLess • runOutsideAngular • markDirty

Slide 5

Slide 5 text

Bundle Size

Slide 6

Slide 6 text

Think twice before add dependency

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Reduce Bundle Size • Think twice before add dependency • Rage-quit: Coder unpublished 17 lines of JavaScript and “broke the Internet” • String.prototype.padStart() • Moment bundle size • ECMAScript Modules • ECMAScript modules • How CommonJS is making your bundles larger • Creating Secondary Entry Points • https://github.com/ng-packagr/ng-packagr/blob/master/docs/secondary-entrypoints.md • Angular Package Format (APF) • Angular Official Dependency • Component Dev Kit (@angular/cdk)

Slide 9

Slide 9 text

Usability

Slide 10

Slide 10 text

Element Selector Attribute Selector VS

Slide 11

Slide 11 text

Use Attribute Selector When • Supporting Original Attributes • Change the behavior of DOM elements • Keep DOM structure Button Input

Slide 12

Slide 12 text

VS

Slide 13

Slide 13 text

Use When • Create multiple copies • Lazy load child component Tabs Space

Slide 14

Slide 14 text

Projection Child Component Virtual Child Component VS

Slide 15

Slide 15 text

Virtual Child Component When • Customize complex template • Reorganize input template Table Select

Slide 16

Slide 16 text

Q&A