Angular FAQ: Top Questions
40. What is AOT compilation in Angular?
AOT (Ahead-of-Time) compilation compiles Angular HTML and TypeScript code into efficient JavaScript before the browser downloads and runs the code. It improves performance and security.
- Faster rendering because templates are precompiled.
- Detects template errors early during build.
- Reduces Angular framework size in final bundle.
It is enabled by default in production builds using ng build --prod
.