0

What I'm trying to do is filter a model value inside controller vía number filter, inside a watch funcion, this is the code:

  .controller('FormSectionCtrl', function ($scope,$filter) {
        console.log( $filter('number')(2.4334444,2));   // At this point, the filter works, the problem starts inside de watch...

        $scope.$watch('input19 * constan1 + input20 * constant2', function (value) {

        // $scope.input23 = value;   ...if I do this, the value is correct but with too much digits after point...I just want 2 digits...

        $scope.input23 = $filter('number')(value);  // It doesn't works...
  });
})

For some reason the $filter doesn't display nothing inside the watch...Anybody has an idea about how to do this properly?

4

0 回答 0