Ben kullanılan Reaktif formu Doğrulama (Model güdümlü onaylama) Açılan değişikliği nesneyi oluşturmak için değeri koyamazsınızaçısal 2 daktilo FormBuilder nesnesine değerini nasıl ayarlanır
Bu benim Formgroup
studentModel:StudenModel
AMform: FormGroup;
Name = new FormControl("", Validators.required);
Address = new FormControl("", Validators.maxLength(16));
constructor(fb: FormBuilder){
this.AMform = fb.group({
"Name": this.Code,
"Address": this.Abbrev,
});
}
onAccntChange(event: Event) {
// set the value from Class Model
//// this.studentModel
// how to set this.studentModel value to form
}
olduğunu
Bu değişim On My html sayfası
<form [formGroup]="AMform" (ngSubmit)="submit()">
<select (change)="onAccntChange($event)" class="form-control" [disabled]="ddlActivity" formControlName="AccountManagerID">
<option value="0">Select</option>
<option *ngFor="let item of allStudent" value={{item.StudentID}}>
{{item.Name}}
</option>
</select>
<div class="col-sm-9">
<input type="text" class="form-control" formControlName="Name">
</div>
<div [hidden]="Name.valid || Code.pristine" class="error"> Name is required </div>
<div class="col-sm-9">
<input type="text" class="form-control" formControlName="Address">
</div>
<div [hidden]="Address.valid || Address.pristine" class="error">Address is required </div>
<button type="submit" class="btn btn-warning "><i class="fa fa-check-square"></i> Save</button>
</form>
i gerekir Sen achievie edebilirsiniz formcontrol değerini
Teşekkürler .. – coder
bunu yapabiliriz bu bir – coder
Name = new FormControl ({value: '', disabled: true}, [Validators.required, Validators.maxLength (10)]); üzerinde değişiklik yapmayı reddedebilirim bana çözüm önerebilirsin ... – coder