When I set initial value of variable to "0", then NumericTextBox field cant show this value.
Code:
<div ng-app="app">
<div ng-controller="MyCtrl">
<input type="text" ng-model="value" kendo-numeric-text-box>
<br>
<input type="text" ng-model="value">
</div>
</div>
JS:
angular.module('app', ['kendo.directives']);
function MyCtrl($scope) {
$scope.value=0;
};
In jsfiddle you can see that simple text field displays zero value, but kendo NumericTextBox is empty. But if you type zero again in simple text field, then zero will be in kendo field too. I think this is a bug, how to get around this problem?
Well, if it is a bug, you can either ask the maintainer of angular-kendo to fix it, or you can fix it yourself. It's a relatively simple fix, I think, because the link function doesn't distinguish between model values 0 and
undefined
. So you'd need to make sure the widget's value method is only called withnull
if the value is actuallynull
or undefined:Here's a demo with a fixed version (links to a fork of angular-kendo, mind you).