angularjs - Calculation on binding in angular -


i using ng-repeat , have array of object.

so according 1 of parameter want resize image.

duration contains time in milliseconds. want change in minutes , set pixel

style="width:{{albumitem.duration}} 

try below code:-

ng-style="{{setwidth(albumitem.duration)}}" 

controller:-

    $scope.setwidth=function(millis){      var minutes = math.floor(millis / 60000);     return{         "width":minutes+"px"       }     } 

plunker hope :)


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -