Peter Boomsma
Peter Boomsma

Reputation: 9844

Use a scope value in a filter

I have a $scope.gemiddeldeCijfer. Each object in this scope has two values, a cijfer and aantalDecimalen. I would like to use the value of aantalDecimalen as the number in a number filter.

This is the html, as you can see the number filter now has a set value of 1. But I would like to replace this value with the value of cijfer.aantalDecimalen.

  <li ng-repeat="cijfer in gemiddeldeCijfer">
    <b>{{cijfer.cijfer | number:1}}</b> - <b>{{cijfer.aantalDecimalen}}</b>
  </li>

http://jsfiddle.net/Kx4Tq/87/

Upvotes: 1

Views: 30

Answers (1)

JB Nizet
JB Nizet

Reputation: 692231

So you want

{{cijfer.cijfer | number:cijfer.aantalDecimalen}}

Upvotes: 2

Related Questions