【发布时间】:2014-03-04 21:46:45
【问题描述】:
我正在尝试访问指令中 $transclude 函数内的“克隆”对象的内容,但 clone.html() 返回未定义。如何访问指令元素/克隆的 html 内容?
.directive('somedirective', function(){
return {
restrict: 'EA'
, replace: true
, transclude: true
, scope: true
, controller: function ($scope, $element, $transclude, $log) {
$transclude(function (clone) {
console.log(clone.html()); //undefined??
console.log(clone.text()); //works but strips the html tags
// How do I access the html content of clone???
})
}
}
【问题讨论】:
标签: angularjs angularjs-directive