Ahead-of-Time Compilation in Angular · Minko Gechev’s blog
- 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.
@mgechev: Understanding Angular’s Ahead-of-Time compilation ⏰🔥 🔧
Recently I added Ahead-of-Time (AoT) compilation support to angular-seed and got a lot of questions about the new feature. In order to answer most of them, we will start from the beginning by explaining the following topics:
The short answer of this question is – We need compilation for achieving higher level of efficiency of our Angular applications. By efficiency I mostly mean performance improvements but also energy and sometimes bandwidth consumption.
For instance, take a look at the…