Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What are Compile, Pre, and Post linking in AngularJS?

Answer Posted / chaitanya

Compile – This compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together. Use the compile function to change the original DOM (template element) before AngularJS creates an instance of it and before a scope is created.

Post-Link – This is executed after the child elements are linked. It is safe to do DOM transformation in the post-linking function. Use the post-link function to execute logic, knowing that all child elements have been compiled and all pre-link and post-link functions of child elements have been executed.

Pre-Link – This is executed before the child elements are linked. Not safe to do DOM transformation since the compiler linking function will fail to locate the correct elements for linking. Use the pre-link function to implement logic that runs when AngularJS has already compiled the child elements, but before any of the child element's post-link functions have been called.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a singleton pattern?

767


Can you disable route guard?

767


What is the difference between routermodule.forroot() vs routermodule.forchild()? Why is it important?

920


Explain The Directives Ng-If, Ng-Switch, And Ng-Repeat?

789


Is .value() the proper way to set app-wide constant and how to retrieve it in a controller?

770


What is data binding and its types?

822


What is the role of $routeprovider in angularjs?

973


What do you understand by angularjs?

847


How do we create a singleton service in angular 2?

782


What is difference between $interval and window. setInterval in AngularJS?

2118


How to generating new pages in angular 4 apps using ionic 3 cli?

847


What is angular and why angular?

838


Explain the different types of streams present in node.js?

799


Explain how we can create module and using it in AngularJS?

869


What is deep linking in angular 2?

894