Skip to main content

Posts

Showing posts with the label Advantages of AOT

Ahead-of-Time (AOT) Compiler - What Is the Angular Compiler?

What Is the Angular Compiler? The Angular compiler converts our applications code ( HTML and TypeScript ) into JavaScript code before browser downloads and runs that code. The @ NgModule metadata plays an important role in guiding the compilation process and also tells the compiler what components to compile for this module and how to link this module with other modules. The Angular offers two ways to compile our application code- 1.       Just-in-Time ( JIT ) - JIT compiles our app in the browser at runtime (compiles before running). 2.       Ahead-of-Time ( AOT ) - AOT compiles our app at build-time (compiles while running). The JIT compilation is the default when we run the build or serve CLI commands - ng build ng serve The AOT compilation, we append the -- aot flags to build or serve CLI commands - ng build -- aot ng serve -- aot Why we need Compilation in Angular? We need c...

What is AOT Compilation? - Pros and Cons of Ahead-of-Time!

What is AOT compilation? Why Use in Angular 2? AOT compilation stands for “Ahead of Time compilation” and it are used to compiles the angular components and templates to native JavaScript and HTML during the build time instead of run-time. The compiled HTML and JavaScript are deployed to the web server so that the compilation and render time can be saved by the browser. It is the big advantage to improve the performance of applications. Advantages of AOT - 1.          Faster download : - The Angular 2 app is already compiled so it is faster. 2.          Faster Rendering : - If the app is not AOT compiled and the compilation process happens in the browser once the application is fully loaded. This has a wait time for all necessary components to be downloaded and then the time taken by the compiler to compile the app. With AOT compilation, this is optimized. 3.      ...