knockout-validation plugin, get isValid from specific property

こ雲淡風輕ζ 提交于 2019-12-10 12:59:23

问题


Is is possible to see if just one property is valid in the knockout-validation plugin?

I could not see any reference to it in the documentation, only the ability to see if the whole model is valid.

For example I wish a computed observable to have a different value depending upon if another observable is valid.


回答1:


I was being led down the wrong direction, as I was using async validators and over complicated my problem, I think it is as simple as:

propertyName.isValid();

e.g.

self.email.isValid();



来源:https://stackoverflow.com/questions/14776948/knockout-validation-plugin-get-isvalid-from-specific-property

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!