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.
Directive with 'replace: true' and template duplicates classes in the attrs parameter of the link fn #8159
Closed
Description
When I create a directive with a template that has a class attribute and replace: true
. The attrs parameter in the link function duplicates the classes. They are also duplicated when I look at the element in the HTML.
This appears to only happen when the tag that the directive is replacing also has a class attribute.
Here is some example code, along with the output I see in the console.
<test class="btn-block"></test>
directive("test", function () {
return {
restrict: 'E',
replace: 'true',
link: function(scope, element, attrs) {
console.log(attrs);
},
template: '<div class="center-block"></div>'
};
})