2
Reply

Explain what is the difference between link and compile in angular.js?

Nitin Choudhary

Nitin Choudhary

Jan 20, 2015
1.8k
0

    Compile function: It is used for template DOM Manipulation and collect all of the directives. Link function: It is used for registering DOM listeners as well as instance DOM manipulation. It is executed once the template has been cloned.

    Nitin Choudhary
    January 20, 2015
    1

    Compile: traverse the DOM and collect all of the directives. The result is a linking function.Link: combine the directives with a scope and produce a live view. Any changes in the scope model are reflected in the view, and any user interactions with the view are reflected in the scope model. Making the scope model a single source of truth.