I have made a service in angular in that service requires accessing the dom properties of different elements, sample call of the service.
panelsService.collectClass(angular.element('.contact-panel-for-same-height'));
I did a console log at the service with this code, console.log('I want to get the offsetHeight of the element', classCollected);
and tried accessing the classCollected.offsetHeight
but it returns undefined.
I found out that the classCollected
is a group of html codes,
and if I forEach classCollected
i will see the actual html code,
I was expecting to get an object to get the offset height.
How do you access these properties with an html code returned?
Update: I can get the height using by adding [0] after classCollected
, code will be classCollected[0].offsetHeight
but the height that I am getting is not the actual height of my div. It is lesser.