1 of 33

Present and Future of Angular with Ivy

2 of 33

Template

Compiler

ViewEngine

Ivy

Gen ☝

Gen ✌

Gen 3️⃣

3 of 33

Ivy is an enabler

3

4 of 33

Design Goals

FLEXIBILITY

  • Simple & easier to pick, understand, & debug
  • HoC
  • Module-less Apps
  • Dynamic Component Loading

OPTIMIZABILITY

  • Only pay for what you use
  • Tree Shaking
  • No metadata files
  • Smaller bundles

INCREMENTALITY

  • Locality
  • Faster compilation, builds, & test execution

4

5 of 33

fn createViewNodes(view: ViewDef) {

view.nodes.forEach(node => {

switch(node.type) {

case ELEMENT: createElement(...)

case TEXT: createText(...)

case DIRECTIVE: createDirectiveInstance(...)

...

}

});

}

Courtesy: @vikerman

Rendering Engine

export function ɵɵelementStart(..) {..}

export function ɵɵtemplate(..) {..}

export function ɵɵtext(..) {..}

...

6 of 33

export function ɵɵelementStart(..) {..}

Credits: @vikerman

Template

Rendering Engine

export function ɵɵtemplate(..) {..}

export function ɵɵtext(..) {..}

...

Tree Shaken

Unused Ivy Instructions

7 of 33

Ivy Instruction Set

  • DOM Creation
  • Data Binding
  • Change Detection
  • I18N
  • Queries
  • Dependency Injection
  • Styling
  • Containers
  • Templates
  • Content Projection
  • Pipes
  • SVG

7

8 of 33

8

9 of 33

9

10 of 33

component.ts

component.html

component.js

component.ngfactory.js

Courtesy: @vikerman

component.js

component.ngsummary.json

component.metadata.json

component.scss

11 of 33

🌳🤝 + 🚫🤘 = 🤏📦

12 of 33

12

13 of 33

14 of 33

14

15 of 33

@NgModule

ɵmod

ɵɵdefineModule

@Directive

ɵdir

ɵɵdefineDirective

@Injectable

ɵprov

ɵɵdefineInjectable

@Pipe

ɵpipe

ɵɵdefinePipe

@Component

ɵcmp

ɵɵdefineComponent

16 of 33

16

17 of 33

Design Goals

FLEXIBILITY

  • Module-less Apps
  • Simple & easier to pick, understand, & debug
  • Dynamic Component Loading
  • HoC

OPTIMIZABILITY

  • Only pay for what you use
  • No metadata files
  • Tree Shaking
  • Smaller bundles

INCREMENTALITY

  • Locality
  • Faster compilation, builds, & test execution

17

18 of 33

Hello World! 👋

I am Siddharth Ajmera

FullStack JS Developer

Angular

Writer

Instructor

19 of 33

PRESENT

A few examples to demonstrate how awesome Ivy is

19

🆕

20 of 33

Small & Meaningful Stacktraces

To get you straight to the source of your error.

20

1

21 of 33

AoT by default

So that you can see the error right while developing

21

2

22 of 33

Lazy Loading Components

So that you can load components lazily and only when required.

22

3

23 of 33

ng Object for 🚫🐛

So that you can debug your code more easily at runtime

23

4

24 of 33

FUTURE

A few examples to demonstrate how Ivy enables the awesome future

24

🔮

25 of 33

Angular Modules are linchpins in an Angular Application

25

26 of 33

Render Components without Angular Modules from Scratch

To write Angular Component from Scratch without much dependency on Angular Modules, ZoneJS etc.

26

1

27 of 33

Render Components without Angular Modules via Compiler

As you might not want to write the whole boilerplate again and again.

27

2

28 of 33

Dynamically Loading a Lazy Component with Ivy’s ɵrenderComponent

To give you the flexibility to load a Component lazily and dynamically

28

3

29 of 33

DI in a Dynamically Loaded Lazy Component

Coz what’s an Angular App without DI?

29

4

30 of 33

30

31 of 33

WHERE FROM HERE?

Into a world of Angular Apps where things like Angular Modules, ZoneJS, and RxJS is optional

31

🤔

32 of 33

Thanks! 🙏

Any questions ?

You can find me at

  • @SiddAjmera
  • SiddAjmera.DEV

32

33 of 33

Credits

Special thanks to all the people who made and released these awesome resources for free:

  • Presentation template by SlidesCarnival
  • Photographs by Unsplash

33