Reputation: 1402
I want to check how many <div class="topology-list">
I have using Angular. At the moment, there are three
I have tried:
angular.element(document.querySelectorAll('.topology-list')).length
This logs 1
(should be 3)
document.querySelectorAll('.topology-list')
Logs 1
too
document.getElementsByClassName('topology-list');
The last one logs an object with the 3 items, but if I add .length
it logs 1
Upvotes: 0
Views: 1066
Reputation: 2330
Create a directive "your-directive" and put it to the outermost of the HTML
Try the above selections in your directive and all of them should give the correct result.
<body ng-app="yourAppName">
<div your-directive>
<!-- Here your all controllers are loaded-->
</div>
</body>
Upvotes: 1