假设有一个简单的 HTML 表单如下:
<form name="myForm" action="#sent" method="post" ng-app>
<input name="userPreference1" type="text" ng-model="shipment.userPreference" />
<input name="userPreference1" type="text" ng-model="shipment.userPreference" />
<input name="userPreference1" type="text" ng-model="shipment.userPreference" />
... submit input and all the other code...
</form>
我希望你能帮我了解如何在至少一个输入为空的情况下检查验证时间。期望的验证如下。用户必须完成至少一项偏好设置。
使用jQuery:
if ( $("input").val() == "" ) {
功能正常,但希望找出使用Angular完成相同操作的方法。
非常感谢您的提前帮助,
Guillermo
!(shipment.userPreference1 || shipment.userPreference2 || shipment.userPreference3)
即可。 - marksyzm