Yours Truly, Famous Inc.
Part of a framework that translates your templates into DOM elements
<div>
<span>{{title}}</span>
<child-cmp *ngIf="show"></child-cmp>
</div>
// Angular core code
function createViewNodes(view: ViewDef) {
view.nodes.foreach(node => {
if(isElementDef(node)) createElement(node);
if(hasListeners(node)) listenToElementOutput(node);
if(hasPipe(node)) createPipeInstance(node);
});
}
Essentially a Map<Component, ComponentFactory>
In Ivy, every component is its own factory
(minified, compressed)
ng new my-app --experemental-ivy
node_modules/.bin/ivy-ngcc
Convert node modules to Ivy-compatible format
Add to tsconfig.json
"angularCompilerOptions": {
"enableIvy": "ngtsc"
}
import { ɵrenderComponent as renderComponent } from '@angular/core';
import { AppComponent } from './app/app.component';
renderComponent(AppComponent);
$0
const cmp = ng.getComponent($0)