Hi I am using angularjs to get a css property value but it is coming back undefined. Here is the code I am using:
var test = angular(document.querySelector('.mobile-menu')).attr('display');
This code is inside a directive.
Hi I am using angularjs to get a css property value but it is coming back undefined. Here is the code I am using:
var test = angular(document.querySelector('.mobile-menu')).attr('display');
This code is inside a directive.
I had found that even if your css class contains display your test var will be empty. you need to define it inside the style attribute of the element
<div class="mobile-menu" style="display: block"></div>
Javascript:
var test = angular.element(document.querySelector('.mobile-menu')).css('display');
alert(test);
JSFiddle: http://jsfiddle.net/AQtc8/
remove the style attribute from the div and test will be empty.