AngularJS Example:
HTML
<form ng-controller="ctrl" ng-app>
<div>
<input type="number" ng-model="num" min="1" max="5" />
<input type="range" ng-model="num" min="1" max="5" />
</div>
<div>
<input type="number" ng-model="num" min="1" max="5" />
<input type="range" ng-model="num" min="1" max="5" />
</div>
</form>
JavaScript
function ctrl($scope) {
$scope.num=1;
$scope.$watch('num', function() {
$scope.num = parseInt($scope.num);
});
}