Pramod M

Pramod M

  • NA
  • 81
  • 9.1k

Validations on Angular js

Jun 4 2019 8:11 AM
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)