Present and Future of Angular with Ivy
Template
Compiler
ViewEngine
Ivy
Gen ☝
Gen ✌
Gen 3️⃣
Ivy is an enabler
3
“
Design Goals
FLEXIBILITY
OPTIMIZABILITY
INCREMENTALITY
4
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(..) {..}
...
export function ɵɵelementStart(..) {..}
Credits: @vikerman
Template
Rendering Engine
export function ɵɵtemplate(..) {..}
export function ɵɵtext(..) {..}
...
Tree Shaken
Unused Ivy Instructions
Ivy Instruction Set
7
8
9
component.ts
component.html
component.js
component.ngfactory.js
Courtesy: @vikerman
component.js
component.ngsummary.json
component.metadata.json
component.scss
🌳🤝 + 🚫🤘 = 🤏📦
12
14
@NgModule
ɵmod
ɵɵdefineModule
@Directive
ɵdir
ɵɵdefineDirective
@Injectable
ɵprov
ɵɵdefineInjectable
@Pipe
ɵpipe
ɵɵdefinePipe
@Component
ɵcmp
ɵɵdefineComponent
16
Design Goals
FLEXIBILITY
OPTIMIZABILITY
INCREMENTALITY
17
Hello World! 👋
I am Siddharth Ajmera
FullStack JS Developer
Angular
Writer
Instructor
PRESENT
A few examples to demonstrate how awesome Ivy is
19
🆕
Small & Meaningful Stacktraces
To get you straight to the source of your error.
20
1
View Engine V/S Ivy
AoT by default
So that you can see the error right while developing
21
2
Lazy Loading Components
So that you can load components lazily and only when required.
22
3
ng Object for 🚫🐛
So that you can debug your code more easily at runtime
23
4
FUTURE
A few examples to demonstrate how Ivy enables the awesome future
24
🔮
Angular Modules are linchpins in an Angular Application
25
“
Render Components without Angular Modules from Scratch
To write Angular Component from Scratch without much dependency on Angular Modules, ZoneJS etc.
26
1
Render Components without Angular Modules via Compiler
As you might not want to write the whole boilerplate again and again.
27
2
Dynamically Loading a Lazy Component with Ivy’s ɵrenderComponent
To give you the flexibility to load a Component lazily and dynamically
28
3
DI in a Dynamically Loaded Lazy Component
Coz what’s an Angular App without DI?
29
4
WHERE FROM HERE?
Into a world of Angular Apps where things like Angular Modules, ZoneJS, and RxJS is optional
31
🤔
Thanks! 🙏
32
Credits
Special thanks to all the people who made and released these awesome resources for free:
33