Explain the compilation process of AngularJS?

Angular’s HTML compiler allows us to teach the browser, new HTML syntax. It also allows the developer to attach new behavior or attributes to any HTML element known as directives. AngularJS compilation process automatically takes place in the web browser. It does not contain any server-side or pre-compilation procedure.

AngularJS uses service for the compilation process of an Angular HTML page. Its compilation process starts after the HTML page (static DOM) is completely loaded.

It occurs in two phases:

Compile
It checks into the entire DOM and collects all of the directives.
Link
It connects the directives with a scope and produces a live view.
The concept of compile and link has been added from C language. The code is compiled and then linked.

Leave a Reply