This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Link fn of a replace+transclude directive runs before transclusion takes place #3558
Closed
Description
I'm unable to access transcluded elements in a link function. The behavior has changed since 1.1.5. See http://plnkr.co/edit/WvGAlByx1771wurPbWXA?p=preview and compare the result with the commented 1.1.5 script
app.directive('test', [function () {
return {
restrict: 'E',
transclude: true,
replace: true,
template: '<div ng-transclude></div>',
link: function postLink(scope, element) {
// This should log 2 as in 1.1.5
console.log(element.children().length);
}
};
}]);
element.children();
should contain the transcluded elements like the `h2' tags:
<test>
<h2>I'm transcluded</h2>
<h2>Me too</h2>
<test>