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

How i can set value in numeric textbox from angularJS?

Hello,

I am using web api for fetch data and bind data in form. so when i assign value in numeric textbox using e-value its working fine. but when data is coming from web api i am using below code for setting value in numeric textbox.

Javascript: 
$("#datePosition").ejNumericTextbox({ value: parseInt($scope.template.sections[0].dateTimeProperties.datePosition) });

CSHTML:
<input id="datePosition" ng-model="template.sections[0].dateTimeProperties.datePosition" type="text" class="form-control" ej-numerictextbox e-minvalue="1" e-maxvalue="999" />

above code is also working but i am getting error in console. i am attaching screenshot of console error stack.

so if is there any other way to set data in numeric textbox using angularjs?

Thanks
Bharat


Attachment: 20151017_1802NumericTextbox_bd826c13.7z

1 Reply

FP Francis Paul Antony Raj Syncfusion Team October 19, 2015 04:21 PM UTC

Hi Bharat,
Thanks for contacting Syncfusion support.
We have analyzed your query. We can set the data in numeric text box using e-value property. And you can also set the data by option (“property”, value) using corresponding object. For your reference we update the value after button click event occurs. Refer the following snippet to set the data in numeric textbox.

<input id="datePosition" ng-model=val type="text" class="form-control" ej-numerictextbox e-minvalue="min" e-value="val" e-maxvalue="max" />



<script type="text/javascript">


    angular.module('syncApp', ['ejangular'])

           .controller('Numericbox', function ($scope) {

               $scope.val = 100;

               $scope.min = 1;

               $scope.max = 999;

               $scope.funclick = function () {

                       // $scope.val = 400;

                       var x = $("#datePosition").data("ejNumericTextbox");

                       x.option("value", 400);

               }

           });

</script>



For your convenience, we have attached a sample. Please check the following link.

http://jsplayground.syncfusion.com/octhevdf

To know more about the list of properties, methods, and events available in dialog, please check the following link
http://help.syncfusion.com/js/api/ejtextboxes
To know more about getting started sample, please check the following link
http://help.syncfusion.com/js/numerictextbox/getting-started
Regards,
Francis Paul A


Loader.
Live Chat Icon For mobile
Up arrow icon