We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Reset angular numeric TextBox to default value on invalid content

Hi I am trying to reset a numeric textbox back to the original value when invalid input is detected (deleting all the contents of the field causes the field to remain empty instead of reverting back to the default)
The main problem is that it is not re-rendering when the $scope.intervallength value changes is there a way of resetting the textbox when the contents are not a number?

    <input id="IntervalLengthSpinner" type="text" ej-numerictextbox e-value="intervalLength" e-focusout="focusOut" e-minvalue="1" e-maxvalue="10000" />

Inside the controller I am using the following:

   $scope.intervalLength = 1;

            $scope.focusOut = function (args) {
                if (!angular.isNumber(args.value)) {

                  console.log("invalid entered");
                   $scope.$apply(function () {
                        $scope.intervalLength = 1;
                    //$scope.intervalLength = 1;
                    // var y = $("#" + args.model.name + "~ .e-select").find(".e-spin.e-spin-up");
                    //   y[0].click();
                    //var u = y.find(".e-spin.e-spin-up");
                    //$("#" + args.model.name[0]).find("e-spin e-spin-up")[0].click();
                    //var t = $("#" + args.model.name);
                    //$scope.$apply(function() {
                    //    $("#" + args.model.name).prop({ "aria-valuenow": 1 });

                    // $scope.$apply();
                else {
                    $scope.intervalLength = args.value;

1 Reply

SN Sasikala Nagarajan Syncfusion Team June 17, 2015 03:54 AM UTC

Hi Robert,

Thanks for using Syncfusion products,

We have analyzed your query. We have prepared the simple sample based on your requirement.

Please get the sample from below location


In this sample, in numeric text box change event, we have validated the numeric text box value and sets to default the value to textboxif the numeric text box value is not a number.

Please refer the below code snippet

$scope.valueChange = function(args) {

if (!angular.isNumber(args.value))



$scope.$apply($scope.nvalue=""); // bind the value to empty before bind the same value to model.




Please check with given sample andlet us know if you further quieries,


Sasikala Nagarajan

Live Chat Icon For mobile
Up arrow icon