Skip to content

Instantly share code, notes, and snippets.

@alxhub
Created February 9, 2022 21:37
Show Gist options
  • Save alxhub/2f70970f688abacd750cff0c3e9f0c00 to your computer and use it in GitHub Desktop.
Save alxhub/2f70970f688abacd750cff0c3e9f0c00 to your computer and use it in GitHub Desktop.
How the Angular Compiler Works - AppComponent After Compilation
import { Component } from '@angular/core';
import * as i0 from "@angular/core";
export class AppCmp {
constructor() {
this.name = 'Alex';
}
}
AppCmp.ɵfac = function AppCmp_Factory(t) { return new (t || AppCmp)(); };
AppCmp.ɵcmp = i0.ɵɵdefineComponent({
type: AppCmp,
selectors: [["app-cmp"]],
decls: 2,
vars: 1,
template: function AppCmp_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "span");
i0.ɵɵtext(1);
i0.ɵɵelementEnd();
}
if (rf & 2) {
i0.ɵɵadvance(1);
i0.ɵɵtextInterpolate1("Your name is ", ctx.name, "");
}
},
encapsulation: 2
});
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AppCmp, [{
type: Component,
args: [{
selector: 'app-cmp',
template: '<span>Your name is {{name}}</span>',
}]
}], null, null); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment