在链接函数中运行带有 transclude 选项的 AngularJS 指令,transclude() 函数在 IE8 中不会返回任何 Clone。它适用于 IE9
HTML
<div data-ng-app="fooApp">
<foo>
<span>(content to transclude)</span>
</foo>
</div>
JS
var app = angular.module('fooApp', []);
app.directive('foo', [function () {
return {
restrict: 'E',
replace: true,
transclude: true,
link: function (scope, element, attrs, ctrl, transclude) {
console.log(transclude())
}
}
}]);
http://plnkr.co/edit/osOY27AUcRSO7QyfRsP9?p=preview
任何想法?