Angular Data Binding - Input type="number"

angularjs, data-binding, javascript

Solution

You're right, it has to do with string vs number types. I used a `$scope.watch` statement to fix it: http://jsfiddle.net/ZvdXp/6/

Problem

I'm having problems binding a number value using AngularJS. I've put a simplified example on JSFiddle: http://jsfiddle.net/treerock/ZvdXp/ ``` <div ng-controller="MyCont" ng-app> <input type="number" min="0" max="50" value="{{value}}" ng-model="value" /> <input type="text" value="{{value}}" ng-model="value" /> <input type="range" min="0" max="50" value="{{value}}" ng-model="value" /> {{value}} </div> ``` This should be three different types of input fields, and if you update one, then all values should update. That's working except for the number input. e.g. If I type 20 in the first number box, it updates all other instances of value. But if I update the text or range inputs, the number input goes blank. I was wondering if the issue was with how the number is represented/converted between fields. e.g. the number input is a float and the text input is a string?

Original source