aot in angular code example

Example 1: aos animation angular

//install
npm install aos --save
//inside the angular.json inside of 'build', look for the 'styles' and 'scripts'
//inside them add:
styles: [... "node_modules/aos/dist/aos.css"]
scripts: [... "node_modules/aos/dist/aos.js"]

//to add AOS for the entire project, at the top of app.component.ts add:

import * as AOS from 'aos';

ngOnInit(){
AOS.init();
}

Example 2: jit compiler vs aot compiler

Ahead-Of-Time(AOT) converts high level language like C. C++ or
intermediate bytecode of a language into a pre-packed and 
compiled file DURING YOUR BUILD TIME.
So no need to wait for compilation at runtime.

Just-In-Time(JIT) compiles intermediate code into machine code
during runtime as needed, then stores currently compiled code
in a cache to reuse as needed while standing by for new calls
to compile until execution is complete. Saves memory.

Tags:

Misc Example