What we are looking to do is, have an input that only accepts 0 - 24 (for a time entry application).
These are the values the user should be able to enter into the inpu
Simply add $scope.time1 = parseInt(savedTime) to the end of your function-
$scope.time1 = parseInt(savedTime)
var savedTime = 0; $scope.onChange = function(time) { if (time > 23 || currentTime > 2) { $scope.time1 = savedTime; } else { savedTime = time; }; $scope.time1 = parseInt(savedTime); };