Below is my 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 I enter any text to my input field, number is not formatted. If I do the same from controller, Its working as expected.
Controller:
$scope.netAmount = kendo.toString(121454, "#,##0.00");
Above snippet works well from controller. But
Expected output from the directive is '1,214.54', but I always get as 12145.
Please help..
I did a blunder mistake. I didnt parse the input value to Float.