You could so something like this (mixing AngularJS/jQuery):
var results = $document[0].getElementsByClassName("hide");
angular.forEach(results, function(result) {
var wrappedResult = angular.element(result);
wrappedResult.hide();
});
However, mixing jQuery into AngularJS application is typically frowned upon, and this just looks like really dirty code that I wouldn't want in a production app.
The best approach and the "Angular" way to do it would be to just wrap your multiple <div>
s with an outer <div>
and use ng-show
/ng-hide
.
<div ng-hide="someTrueVariable">
<div class="hide"></div>
<div class="hide"></div>
<div class="hide"></div>
</div>
If you are coming from a jQuery background and are moving into AngularJS, I would highly suggest you take a look at the following Stack Overflow thread. I really think this will help put you into an AngularJS development mindset:
"Thinking in AngularJS" if I have a jQuery background?