1

I am using ng-repeat and have a array of object.

So according to one of the parameter I want to resize image.

Duration contains time in milliseconds. I want to change it in minutes and set it as pixel

style="width:{{albumItem.duration}}
3
  • Please share your script Commented Jul 2, 2015 at 6:44
  • i dnt thing sharing script will help...i want to change on front end and not on javascript/angular side Commented Jul 2, 2015 at 6:45
  • what you doing is nothing but JavaScript and angular part. You can convert time to mins on fly in your controller. The code which you share is working code.What problem are you facing is not clear . Commented Jul 2, 2015 at 6:59

1 Answer 1

1

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 it help :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.