1

NOTE: in this example I am using 'height', but I will be querying other css properties also.


I have media queries that are setting an element's height.

I have an angular directive that watches that height.

The height changes when window is resized (manually), and the watch function is called (via .digest()), but the .css('height') is empty.

  return element.css("height") ; // --> nothing

please see my plunker.

1
  • I haven't answered why but i made it working if you like it give me upvote and accept as ans otherwise i will remove my answer Commented Mar 1, 2016 at 16:01

1 Answer 1

1

I have tried to answer your question

instead of this element.css("height");

Try using below code

element[0].offsetHeight

Check the updated plunker code http://plnkr.co/edit/PdaVBjutGeEn7csNm1ki?p=preview

Sign up to request clarification or add additional context in comments.

1 Comment

thanks ... I did not mention in my question that I am not necessarily interested in height, per-se. I just used height for my example ... ... however, you did get it to work, as per my example ... +1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.