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
Post a Comment