Reputation: 10838
I have a Kendo numeric text box in a directive. Even though I have set the min and max fields user is able to enter values beyond the range. This is the template string:
public template: string = '<input name = "numberField" type="text" id="searchIntNumberBox{{hashkey}}" required="required" ng-model="number" kendo-numeric-text-box k-options="options"' +
'min="{{minimumValue}}" max="{{maximumValue}}" maxlength = "{{maximumLength}}" step="5" style="width: 100%;height:26px"" />';
This is the options
$scope.options = {
decimals: 0,
format: '#',
spin: (e) => {
const value = e.sender.value();
$scope.number = value;
$scope.$apply();
},
};
Can someone let me know what I am doing wrong. The min value is 0 and max value is 2147483647 but I can enter negative values and also values above the max value.
Upvotes: 0
Views: 2868
Reputation: 390
When using kendo settings in the html format you need to add "k-":
public template: string = '<input name = "numberField" type="text" id="searchIntNumberBox{{hashkey}}" required="required" ng-model="number" kendo-numeric-text-box k-options="options" k-min="minimumValue" k-max="maximumValue" maxlength = "{{maximumLength}}" step="5" style="width: 100%;height:26px"" />';
Or in Controller:
$scope.options = {
decimals: 0,
format: '#',
spin: (e) => {
const value = e.sender.value();
$scope.number = value;
$scope.$apply();
},
min:yourMinValue,
max:yourMaxValue
};
Upvotes: 2