0

私がやろうとしているのは、ウォッチ関数内の数値フィルターを介してコントローラー内のモデル値をフィルター処理することです。これはコードです:

  .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...
  });
})

何らかの理由で、 $filter は時計の中に何も表示しません...これを適切に行う方法について誰か考えがありますか?

4

0 に答える 0