Every Angular application consists of components and templates that the browser cannot understand. Therefore, all the Angular applications need to be compiled first before running inside the browser.
Angular provides two types of compilation:
JIT(Just-in-Time) compilation
AOT(Ahead-of-Time) compilation
In JIT compilation, the application compiles inside the browser during runtime. Whereas in the AOT compilation, the application compiles during the build time.
The Angular ahead-of-time (AOT) compiler converts your Angular HTML and TypeScript code into efficient JavaScript code during the build phase before the browser downloads and runs php widget wordpress that code. Compiling your application during the build process provides a faster rendering in the browser.
In computer science, ahead-of-time compilation is the act of compiling an higher-level programming language into an lower-level language before execution of a program, usually at build-time, to reduce the amount of work needed to be performed at run time.
The advantages of using AOT compilation are:
Since the application compiles before running inside the browser, the browser loads the executable code and renders the application immediately, which leads to faster rendering.
In AOT compilation, the compiler sends the external HTML and CSS files along with the application, eliminating separate AJAX requests for those source files, which leads to fewer ajax requests.
Developers can detect and handle errors during the building phase, which helps in minimizing errors.
The AOT compiler adds HTML and templates into the JS files before they run inside the browser. Due to footer widgets for wordpress this, there are no extra HTML files to be read, which provide better security to the application.
By default, angular builds and serves the application using JIT compiler:
ng build
ng serve
For using AOT compiler following changes should be made:
ng build — aot
ng serve — aot