0
AngularJsにng-repeatセクションを追加しました。私は必要なフィールドバリデーターを追加しました。ただし、スパンタグのデータが表示されているので、すべてのフィールドが空になるとページの高さが上がります。エラーを説明するng-repeatセクションの後に1つのエラーメッセージしか表示できません。現在のUIコードは以下の通りです:ng-repeatセクションの後にエラーメッセージを表示します
<div class="row" ng-if="selectedSeasonType">
<div class="form-group ">
<label class="form-group col-md-3">Language</label>
<label class="form-group col-md-4">Title</label>
<label class="form-group col-md-5">Description</label>
</div>
</div>
<br />
<div class="row" ng-repeat="Descriptions in seasonsWithDescription" ng-if="selectedSeasonType">
<div class="form-group col-md-2 top-Margin-language">
<label ng-model="Descriptions.Language">{{Descriptions.Language}}</label>
</div>
<div class="form-group col-md-4 top-Margin-Title">
<input type="text" maxlength="150" class="form-control input-md" required="" name="titleValidate_{{$index}}" ng-model="Descriptions.Title" />
<span style="color:red" ng-show="submitted == true && mainForm.titleValidate_{{$index}}.$error.required">Title is required</span>
</div>
<div class="form-group col-md-5">
<textarea maxlength="500" class="form-control input-md noresize" required="" name="descriptionValidate_{{$index}}" noresize="" ng-model="Descriptions.Description"></textarea>
<span style="color:red" ng-show="submitted == true && mainForm.descriptionValidate_{{$index}}.$error.required">Description is required</span>
</div>
<div class="form-group col-md-1">
<a style="cursor:pointer">
<img ng-src="{{DeleteIcon_url}}" alt="delete image" ng-click="($index == !selectedDeleteIcon) || seasonsWithDescription.splice($index,1)" ng-class="{'disabled': $first}" />
</a>
</div>
</div>
AngularJsで必要なデータを記述するためにNG-繰り返しセクションの後に一つだけのエラーメッセージを追加する方法は? ありがとう
ng-repeatセクションの後に独自のカスタムエラーmsgを追加できますか。 – sisyphus
こんにちは、少なくとも10行あり、タイトルテキストボックスと説明テキストエリアがあります。私は、エラーメッセージを表示する方法はわかりません。 「タイトル」が空、「説明」が空、または両方が空です。 – venkat14
それはものです。あなたはあなたの質問をより具体的にする必要があります。今、「タイトル」があるとしましょう。空のタイトルごとにエラーメッセージを表示しますか?またはタイトルの1つが欠落している場合、下部にエラーメッセージを1つ表示しますか?前者の場合は、自分がやっていることを続行する必要があります。後者の場合、ng-show/hideメカニズムを使用したカスタムエラーmsgが必要です。 1つの方法は、すべての空でないタイトルのカウンターを用意することです。カウントがリピートサイズより小さい場合、エラーを表示します。 – sisyphus