I am having trouble with angularjs directives finding child DOM elements with the injected angular element.
For example I have a directive like so:
myApp.directive('test', function () {
return {
restrict: "A",
link: function (scope, elm, attr) {
var look = elm.find('#findme');
elm.addClass("addedClass");
console.log(look);
}
};
});
and HTML such as :
<div ng-app="myApp">
<div test>TEST Div
<div id="findme"></div>
</div>
</div>
I have access to the element which is proffed by adding a class to it. However attempting to access a child element produces an empty array in the var look.
Why is something so trivial not working properly?