While working on a directive, I am facing an issue with using the element
parameter to locate its children by class name.
.directive("ngScrollList", function(){
return {
restrict: 'AE',
link: function($scope, element, attrs, controller) {
var scrollable = element.find('div.list-scrollable');
...
}
};
})
Although I can locate it by the tag name, I am unsuccessful in finding it by class name, as evident from the console output:
element.find('div')
[<div class="list-viewport">…</div>,<div class="list-scrollable">…</div>]
element.find('div.list-scrollable')
[]
What is the correct approach to achieving this? I am aware that I can incorporate jQuery, but I am concerned if that would be excessive....