Can't calculate offsetHeight from an element in AngularJS

Viewed 668

I've got the following directive:

app.directive('myObject', function(){
  return {
    restrict: 'A',
    link: function(scope, elem){
      console.log(elem[0].offsetHeight);
    }
  };
});

Which basically is logging the offsetHeight of its target element, but it isn't working. I guess its because its calculating the height when the element hasn't got any content yet.

How can I resolve this issue without using a timeout? Is there any built in solution for this problem?

Plunkr

1 Answers
Related