Compile function: It is used for template DOM manipulation and collects all of the directives. Link function: It is used for registering DOM listeners as well as for instance, DOM manipulation. It is executed once the template has been cloned. Post navigation Explain injector in AngularJS What is the factory function in AngularJS?