I have this function to convert from dp (density independent) to px (pixels):
$rootScope.dp2px = function(dp) {
if(!!dp) {
var px = window.devicePixelRatio * dp / 160;
return px.toPrecision(2);
} else {
return 0;
}
}
The function has no error. But when I want to use the function in angularjs view like:
<h6 style="font-size:{{dp2px(2901.33)}}px !important; width:{{dp2px(17067)}}px !important;" ng-click="openPopoverGiftBox($event)">{{countergift}}</h6>
Then the output become:
<h6 style="font-size:17px !important; width:1.0e+2px !important;" ng-click="openPopoverGiftBox($event)" class="ng-binding">4 Jam</h6>
How let the value of 1.0e+2px always 100px?
Anyone can help me?