angularjs - Kendo.toString number format not working -


below directive

app.directive("numberformatdirective", function ($kwindow) {                 return {                          require: "ngmodel",              link : function(scope,elem,attr,ctrl)              {                                 function parsedata(text) {                      return kendo.tostring(text, "#,##0.00");                  }                    ctrl.$parsers.push(parsedata);                  ctrl.$formatters.push(parsedata);              }            }        })

when enter text input field, number not formatted. if same controller, working expected.

controller:

        $scope.netamount = kendo.tostring(121454, "#,##0.00");

above snippet works controller. but

expected output directive '1,214.54', 12145.

please help..

i did blunder mistake. didnt parse input value float.

app.directive("numberformatdirective", function ($kwindow) {                 return {                          require: "ngmodel",              link : function(scope,elem,attr,ctrl)              {                                 function parsedata(text) {                      return kendo.tostring(parsefloat(text), "#,##0.00");                  }                    ctrl.$parsers.push(parsedata);                  ctrl.$formatters.push(parsedata);              }            }        })


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -