kendo ui, angular 需要验证数字文本框 [英] kendo ui, angular require validation for numeric text box
问题描述
我正在尝试使用带有角度验证(ng-required)的剑道数字文本框,但是我无法让它工作.此元素上的 ng-required 属性对表单验证状态没有影响.
I am trying to use a kendo numeric text box with angular validation (ng-required) however I'm not able to get it working. The ng-required attribute on this element has no effect on the form validation status.
据我所知,这不起作用的原因是因为剑道数字文本框使用 k-ng-model 来存储它的值,而角度验证仅适用于 ng-model.
From my understanding, the reason why this doesn't work is because kendo numeric text box uses k-ng-model to store it's value, whereas the angular validation works only with ng-model.
有没有其他人看到过这个问题,有什么解决方法吗?
Has anyone else seen this issue, are there any workarounds?
推荐答案
我找到了一种解决方法,涉及使用 kendo-numeric-text-box 以及使用 ng-model 的隐藏输入字段.
I have found a workaround that involves using the kendo-numeric-text-box along with a hidden input field which makes use of ng-model.
<input data-kendo-numeric-text-box data-k-ng-model="numValue"/>
<input type="hidden" data-ng-model="numValue" data-ng-required="true" />
这篇关于kendo ui, angular 需要验证数字文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!