In the edit mode of the form, the value from the database is not selected. I get the correct value in 'service.formData.SalesRepId', but somehow it is not selected. Am I missing something?
below is the code
<select
#select name="SalesRepId"
#SalesRepId="ngModel"
[(ngModel)]="service.formData.SalesRepId"
class="form-control">
<option value="">-Select-</option>
<option
*ngFor="let rep of this.service.staffUsers"
[value]="rep.UserId">
{{rep.FullName}}
</option>
</select>
Below is the type-script which retrieves the data. On the console log, I get all the correct SalesRepId
this.bsModalRef = this.bsModalService.show(EditSurveyRequestComponent, { class: 'modal-xl' });
(<EditSurveyRequestComponent>this.bsModalRef.content).isUserRoleAdminFromParent = this.nav.isUserRoleAdmin;
this.service.getSurveyRequestDetailsById(SurveyRequestId).subscribe(data => {
this.service.formData = data as SurveyRequests;
console.log(this.service.formData.SalesRepId);
})