angularjs - Replace and transclude in link section of directive -
i have directive needs conditionally replace node on placed; replaces it, leaves is.
this in non-replace situation:
transclude(scope, function(clone){ element.append(clone); });
and works fine.
i able set on node replace template, transcluding it. how that?
the next seems work:
var node= angular.element('<a href="" role="button"></a>'); transclude(scope, function(clone){ node.append(clone); element.replacewith($compile(node)(scope)) });
use outerhtml
replace:
element[0].outerhtml = '<a href="" role="button"></a>';
and compile template transclude it.
references
angularjs source: jqlitespec.js angularjs directive
No comments:
Post a Comment