I created a directive and I'm trying to get a DOM element inside ng-transclude, but when I do a find () looking for elemnto, jqLite does not find
HTML using directive:
<categorias>
<span class="category-name"> categoria </span>
</categorias>
Template of the directive:
<div id="categorias">
<ng-transclude></ng-transclude>
</div>
Javascript da directive:
function categorias() {
var directive = {
restrict: 'E',
replace: true,
templateUrl: 'categoria.html',
transclude: true,
link: function(scope, elem, attrs) {
elem.on('mouseover', function() {
var name = elem.find('.category-name'):
console.log(name)
})
}
}
return directive;
}
When you mouseover the element in the console.log, an empty object appears:
JQLite {}
How do I get the dom elements that are inside ng-transclude?