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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Reset angular numeric TextBox to default value on invalid content

Thread ID:





119391 Jun 15,2015 12:17 PM UTC Jun 17,2015 03:54 AM UTC JavaScript 1
Tags: General
Robert David
Asked On June 15, 2015 12:17 PM UTC

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;

Sasikala Nagarajan [Syncfusion]
Replied On 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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon