Angular TypeScript input change event

0

I have an input field that starts with a number ('.2-2'). This input is updated when a select field modifies its value. When this field is modified, the value of the numver input does not obey the formatting. The default value is formatted by default

<div class="col-sm-12 col">

  <label class="control-label" for="ID_MONTHLY_VALUE">{{txtMonthl_value}}</label>
  <input type="text" style="text-align:right;font-weight: bold" formControlName="OriginalMonthlyValue" class="form-control input-sm" disabled />
  <!--<input type="text" style="text-align:right;font-weight: bold" [(ngModel)]="OriginalMonthlyValue.value" class="form-control input-sm" />-->

</div>

I'm looking for a solution. Has anyone had this problem and can you kindly help me?

    
asked by anonymous 13.03.2018 / 14:56

1 answer

0

You will have to point directly to the formControl inside the formGroup (pex formGroup.OriginalMonthlyValue ) and then make setValue() in that form-control.

Since you are not using an ngModel, the model associated with formControl (aka your value prop) has never been updated automatically, so you will have to do it by hand. if !! (however) the input is changed by the user - this setValue is done automatically.

More information about FormControl

    
10.04.2018 / 15:58