Kendo 数字文本框最小最大值不起作用
Kendo numeric text box min max values not working
我在指令中有一个 Kendo 数字文本框。即使我已经设置了最小和最大字段,用户也可以输入超出范围的值。这是模板字符串:
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"" />';
这是选项
$scope.options = {
decimals: 0,
format: '#',
spin: (e) => {
const value = e.sender.value();
$scope.number = value;
$scope.$apply();
},
};
谁能告诉我我做错了什么。最小值为 0,最大值为 2147483647,但我可以输入负值以及高于最大值的值。
在 html 格式中使用 kendo 设置时,您需要添加 "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"" />';
或者在控制器中:
$scope.options = {
decimals: 0,
format: '#',
spin: (e) => {
const value = e.sender.value();
$scope.number = value;
$scope.$apply();
},
min:yourMinValue,
max:yourMaxValue
};
我在指令中有一个 Kendo 数字文本框。即使我已经设置了最小和最大字段,用户也可以输入超出范围的值。这是模板字符串:
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"" />';
这是选项
$scope.options = {
decimals: 0,
format: '#',
spin: (e) => {
const value = e.sender.value();
$scope.number = value;
$scope.$apply();
},
};
谁能告诉我我做错了什么。最小值为 0,最大值为 2147483647,但我可以输入负值以及高于最大值的值。
在 html 格式中使用 kendo 设置时,您需要添加 "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"" />';
或者在控制器中:
$scope.options = {
decimals: 0,
format: '#',
spin: (e) => {
const value = e.sender.value();
$scope.number = value;
$scope.$apply();
},
min:yourMinValue,
max:yourMaxValue
};