angularjs - What exactly do you do with the transclude function and the clone linking function? -
From
, I see that the compiled function has 3 parameters, one of which is transcript - A transduction linking function: function (scope, clonlinking FN). I'm trying to understand exactly what you will be in the cloning connecting function. I do not even know which criteria have come out in it. I think there is a parameter called I understand with simple examples, but I think along with the Edit: My answer is completely and completely changing and it is " Community wiki "(no number for me) As I answered when it was wrong outright As @ Jonah indicated below, the original The idea is that the compilation function should be returned to a link function, you can use the closing function provided within the linking function, in which cloning the DOM element Receive, compile it, and put it to put it. It gives you the chance of compiling the function that you created the linking function and converted the DOM elements into programs based on the properties passed before the call. transclude docs The only explanation provided is:
clone which appears to be an HTML element, are there other parameters available? Which HTML element is this exactly? I'm probably looking at the
transclude: 'element' in my instructions. What are the answers to those questions when using
true instead of
element?
transclude: 'element' to find more complex examples. I am hoping someone can provide more in depth information about this. Thank you.
/ / A silly instruction to replicate objects of a dictionary object App.directive ('keyvaluerepeat', function ($ compile)) {return: true, scope: {data: '=', showDebug: '@'}, compile: function (elem, attrs, transclude) {if (attrs .showDebug) {elem.append ("div class =" debug "> debuts enabled {{showDebug}} ;);} return function (scope, LEEM, waves) ) {Var items = []; Console.log (lElem); Scope $ Watch ('data', function (data) {// delete old values from tracking array / (see below) (var i = items.length; i-- & gt;); item (i) element. (); Item [i] .scope. $ Deleted (); item.model (i, 1);} Add new (var key in data) {var val = data [key], childScope = scope. $ New (), childElement = angular.element ('
Comments
Post a Comment