When loading my "multiple edit" screen, I default the values as follows:
private createFormGroupItem(item: ...): FormGroup {
return this.formBuilder.group({
title: new FormControl(item.title, [Validators.required]),
effectiveDate: new FormControl(item.effectiveDate, [Validators.required]),
tariff: new FormControl(this.ddlTariff[0].tariffId, [Validators.required])
});
}
The title and date fields get filled with saved values, but I am uncertain about the syntax to have the saved value for Tariff dropdown selected.
Essentially, the FormControl is populated with records, and I want the one with the item.tariff value to be automatically chosen.
I found a stackblitz that demonstrates similar functionality, but I'm unsure how to adapt it to test with an actual object in my project.