Ich habe einen unteren Code, der 3 Textfelder generiert. Nun das Problem ist, wenn ich auf eines der Textfelder klicke, werden alle 3 Textfelder fokussiert, obwohl sie unterschiedliche Werte für Name und Label haben.AngularJs Validation CSS Fehler
<div class="col-md-12" data-ng-repeat="dohPolicy in [1,2,3]">
<div class="col-md-2" style="padding:0px; margin-right:1%;">
<p style="font-size:11px;">P no {{dohPolicy}} </p>
</div>
<div class="form-group col-md-6"
data-ng-class='{ "has-focus": dohForm.dohPolicy.hasFocus,
"has-success": dohForm.dohPolicy.$valid,
"has-error": dohForm.dohPolicy.$invalid && (dohForm.$submitted || dohForm.dohPolicy.$touched),
"is-empty": !dohForm.dohPolicy.$viewValue }'
style="right: 150px; bottom: 40px; padding: 0; width:20%;">
<label for="dohPolicy"></label>
<input type="text" name="dohPolicy"
data-ng-model="dohPolicy" required readonly
data-ng-blur='dohForm.dohPolicy.hasFocus=false'
data-ng-focus='dohForm.dohPolicy.hasFocus=true'>
<p data-ng-show="dohForm.dohPolicy.$error.required && (dohForm.dohPolicy.$touched || submitted)"
class="error-block">
P Number(s)
</p>
</div>
</div>
Obwohl ich versuchte, String-Arrays zu verwenden, aber nicht in der Lage, das Problem zu lösen. Ich möchte, wenn ich auf ein bestimmtes Textfeld nur dieses Textfeld klicken Fokus und markiert.
Jede Hilfe wird geschätzt!
Dank
dynamisch validieren können Sie einen Code-Schnipsel in codepen erstellen. –