2
Answers

Validations on Angular js

below code shows ExportApplicationQuantity comes from db And SBQuantity is an input field how to validate input fields with ExportApplicationQuantity ,here SBQuantity not more than ExportApplicationQuantity.
 
here is below code
 
<td>{{sBill.ExportApplicationQuantity}}</td>
<td>
<input type="text" [min]="0.001" class="form-control" maxlength="12" required name="SBQuantity-{{in}}" #SBQuantity="ngModel"
id="SBQuantity" [(ngModel)]="losses.SBQuantity" pattern="^[0-9]{1,12}(?:\.[0-9]{1,3})?$"
app-restrict-input="floatWithThreeDecimalPlaces" (ngModelChange)=" calculateLoss()">
<div *ngIf="SBQuantity.errors && SBQuantity.touched && SBQuantity?.errors.required" class="alert alert-danger">
SBQuantity is required.
</div>
</td>

Answers (2)