| Angular Concepts (Basics to Advanced) | Angular-Interpolation | |
Angular JIT vs AOT |
In Angular, JIT compilation means the application compiles in the browser at runtime. Angular compiler compiles your TypeScript and templates into JavaScript code on the client side when the app loads.
AOT compilation means the Angular compiler runs at build time and generates optimized JavaScript before deployment. The browser downloads and runs the precompiled application.
| Aspect | JIT | AOT |
|---|---|---|
| When compiled | At runtime in the browser | At build time before deployment |
| Build time | Faster builds | Slower builds (extra compilation step) |
| App startup | Slower (compilation happens in browser) | Faster (precompiled code runs immediately) |
| Bundle size | Larger | Smaller and optimized |
| Use cases | Development and debugging | Production deployment |
Consider building an Angular app using the Angular CLI:
ng serve
This serves the app with JIT compilation. Fast build, good for development with live reload, but slower startup in the browser.
ng build --prod --aot
This builds the app with AOT compilation. The templates are compiled ahead of time, resulting in smaller bundles and faster load times in production.
JIT: Faster developer builds, good for local testing.
AOT: Slower build but faster runtime, smaller bundles, best for production.
| Angular Concepts (Basics to Advanced) | Angular-Interpolation | |