Member-only story

AOT in Angular

Pravin M
2 min readJan 11, 2024

--

AOT in Angular

Source: AOT in Angular

For more questions and answers visit our website at Frontend Interview Questions

For better Understanding it is first important to understand what is JIT which used to be default Angular compilation mode till Angular 8. After JIT , we will se how AOT works and how its different from JIT :

Just-in-Time (JIT)

In JIT compilation mode the TS code written by the developer is compiled to JS code during the build creation. Now, this compiled js code still contains some angular specific code ( for components, decorators, change detection, Dependency Injection etc.)which is compiled at the browser end again at runtime ,with the help of JIT compiler sent along with the build .

In JIT mode when Angular application is bootstrapped in the browser, the JIT compiler performs a lot of work to analyze the components in the application at runtime and generate code in memory. When the page is refreshed, all the work that has been done is thrown away, and the JIT compiler does the work all over again.

Ahead-of-Time (AOT)

The TS code written by the developer is compiled to JS code, this js has already been compiled for angular as well. Now, this compiled js code is compiled by the browser again so that the html can be rendered. But, the catch here is that the…

--

--

Pravin M
Pravin M

Written by Pravin M

I am a frontend developer with 10+ years of experience Blog :- https://www.frontendinterviewquestions.com

No responses yet