Fellow Ionites
I’m have a form created with FormBuilder, and I wish to manually at certain points to update the ‘value’ fields (both displayed and actual values) of its controls.
I’m using updateValue method, but Visual Studio complains that does not have such a method. Compiler also complains the same. Still the form works like a charm.
Am I doing something wrong? or is it a bug in the definitions of FormBuilder and its compoents?
Am I treading on ‘supported’ waters here and fall-through a hole in the future?
part of my myForm.html
<form [ngFormModel]="_myForm">
<ion-item>
<ion-label>First Name</ion-label>
<ion-input #FirstName ngControl="FirstName" type="text"></ion-input>
</ion-item>
</form>
part of myForm.ts
private _formData={FirstName: "A first name"};
private _myForm:ControlGroup=this._formBuilder.group({
FirstName:['',Validators.required]
});
private _refreshControlsWithProfileData(){
this._myForm.controls['FirstName'].updateValue(this._formData.FirstName);
}
Thank you in advance