In angularJS we can use Directives to access the elements and we can set properties using these Directives. I want to get/set some properties for DOM elements without using Directives.
<div class=main ng-app="myApp" ng-controller="SalesController">
<div class=ele1> </div>
<div class=ele2> </div>
<div class=ele3></div>
</div>
In some places I want the height of some elements to do some calculations:
var myApp = angular.module('myApp', []);
myApp.controller('SalesController',function($scope){
//this code not working
document.getElementsByClassName("ele1").clientHeight;
});
I know how to get the height by using directives but in some case we need height/width of div elements in different part of the project, adding directive every time will increase the code.
Is there a single line way to find the height/width of a div in angularjs (like $("classname").height()
in jquery)? I would prefer to do so without using jQuery.