Reputation: 1863
In my angularjs application on ng-click on a button, I have
$scope.getItems = function() {
var matchedElements = angular.element(document).find('.main_tabSet');
console.log(matchedElements.length);
}
which is working fine.
Now there are few bootstrap classes which are injected below main_tabSet
, which I am trying to access in ng-click as
var matchedElements = angular.element(document).find('.main_tabSet .nav .nav-tabs');
but this is not returning the elements. What is the right way of accessing elements using nested classes?
Upvotes: 0
Views: 1380
Reputation: 8121
You want to use querySelector
like so :
var matchedElements = angular.element(document.querySelector('.main_tabSet .nav .nav-tabs'));
From their own docs on find()
: f
find() - Limited to lookups by tag name
And very much related question :
Upvotes: 2