私は使用してng-messages
おり、繰り返す必要なく、1 つのコード ブロックで複数のフィールドをチェックできるかどうかを知りたいです。
だから私は持っています:(メモcheckCustom
は私が書いたカスタムディレクティブです)
<div ng-messages="registrationForm.field1.$error" ng-if="registrationFormValid">
<span ng-message="required">please enter field 1</span>
<span ng-message="checkCustom">please check custom value</span>
</div>
と
<div ng-messages="registrationForm.field2.$error" ng-if="registrationFormValid">
<span ng-message="required">please enter field 1</span>
<span ng-message="checkCustom">please check custom value</span>
</div>
しかし、私はむしろ次のようなものを望んでいます:
<div ng-messages="registrationForm.field1.$error || registrationForm.field2.$error" ng-if="registrationFormValid">
<span ng-message="required">please enter field 1</span>
<span ng-message="checkCustom">please check custom value</span>
</div>
このようなことは可能ですか?
ありがとう