2

So I have the following scenario:

var app = angular.module('app', []);

app.controller('MainCtrl', function($scope) {
  
  $scope.number  =7.00;
  
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body ng-app="app">
  <div ng-controller="MainCtrl">  
    <div class="div-table-row">
        <input type="number" step="0.01" ng-model="number" />
      </div>
  </div>
</body>

Even though I set the number variable with 2 decimals angular is removing both 0s after the dot. How can I prevent this and show the whole number 7.00 inside the input. I know you can use the filter on spans but what about inputs?

1

0

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.