In a web app (AngualrJS 1.5 + HTML5) I have an input type="number". I want to step in 0.5. The problem is that if the user write 0.7, the form doesn't notificate the error. How can I do to automatic round the number in the field?
This is the html code:
<input type="number" ng-model="height" name="height" min="1" max="10000" step="0.5">
I've tried to add this js code when I save the page:
$scope.age = (Math.round($scope.age * 2) / 2).toFixed(1);
but I get this error in console:
angular.js?v=0.2:13708 Error: [ngModel:numfmt] Expected `6.0` to be a number
UPDATE: I've made a plunker: PLNKR