I want to get an element width, but when I inspect the element, it have 71px, but when I debug the value is 69px.
app.directive('minijobsItemPrincipal', function ( ) {
return {
restrict: "C",
controller: function ( $element, $window ) {
this.getItemWidth = function ( ) {
$element.css('background-color', 'red');
console.log ( $element[0].offsetWidth )
}
}
};
});
So, if I use console.log ( $element )
, and I search in console the clientWidth
value appears 71px, but if I use console.log ( $element[0].clientWidth )
, it appears 69px, I can't understand why.