pInputText label not working on reactive form update
Posted: 07 Dec 2017, 17:40
I have a problem when using a simple text input with floating label, whenever i update the value of the fields in my form using patchValue, the UI keeps the label on top of the value of the field. I have tried focusing the element programatically and it doesnt fix it, but if you click on the actual element using the UI, then all the labels get fixed
this is the code of the view
and this is the code of the component
this is the code of the view
Code: Select all
<div class="ui-g-12 ui-md-6">
<span class="md-inputfield">
<input #first type="text" pInputText formControlName="codigo">
<label>Codigo</label>
</span>
<div class="input-error" *ngIf="determinacionForm.get('codigo').hasError('required') && determinacionForm.get('codigo').touched">
Ingrese el Codigo
</div>
</div>
Code: Select all
this.determinacionForm = this.fb.group({
codigo: ['', Validators.required],
abreviatura: ['', Validators.required],
nombre: ['', Validators.required],
habilitado: [],
tipo: [],
protocoloId: [],
especialidadId: ['', Validators.required],
peso: ['', Validators.required],
unidadesBioquimicas: ['', Validators.required],
valoresReferencia: [],
obrasSociales: [],
derivada: [false]
}, {
validator: this.hasProtocolo
});
this.determinacionForm.patchValue(this.determinacion);