Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

ngClass item.value ReactiveForm not working

$
0
0

I need to make a dynamic validation in the form, the problem is that I take the value of the item, but it is not validating when the value of the input is at 0, if someone can help me please: P

<div class="row form-group">
        <div class="col-12 mt-2">
          <label for="price">Precio</label>
          <input type="number" formControlName="price" (keyup)="totalSum()" id="price" class="form-control"
          [ngClass]="{'is-valid': price.dirty && !price.invalid, 'is-invalid': price.dirty && price.invalid && price.value === 0}">

          <div class="valid-feedback">
            <span>!Correcto!</span>
          </div>

          <div class="invalid-feedback">
            <span *ngIf="price.errors?.required">Valor requerido</span>
          </div>

        </div>
      </div>

Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>