JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!

Ahead-of-Time Compilation in Angular

  • In other words, by having a different implementation of the renderer we can use the same AoT compiled component and render it without any changes in the code.
  • The Angular template compiler receives as an input a component and a context (we can think of the context as a position in the component tree) and produces the following files:

    is a placeholder for the file’s name.

  • If we want to emit TypeScript as output of the AoT compilation process we must make sure we access only public fields in the templates of our components.
  • Since TypeScript has access modifiers, and enforces access only to public properties outside the inheritance chain, inside the internal component we cannot access any private properties part of the context object, so both:

    will throw a compile time error in the generated .

  • For this component, the Angular compiler will generate two classes:

    will be responsible for rendering the template of and also, performing change detection.

Ahead-of-Time Compilation in Angular – Minko Gechev’s blog

Comments are closed, but trackbacks and pingbacks are open.