kendo ui,角度要求对数字文本框进行验证 [英] kendo ui, angular require validation for numeric text box
问题描述
我正在尝试使用带有角度验证的kendo数字文本框(需要ng),但是我无法使其正常运行.该元素上的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.
据我了解,之所以不起作用,是因为kendo数字文本框使用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,角度要求对数字文本框进行验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!