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

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -