dsdsdsdsd
dsdsdsdsd

Reputation: 2962

Why is angular .css method not detecting media query changes

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.

Upvotes: 1

Views: 173

Answers (1)

Siddharth Pandey
Siddharth Pandey

Reputation: 669

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

Upvotes: 1

Related Questions