I've a JSON formatted data coming from back-end, with gender as a select tag in front-end I'm unable to pre-select the option that comes with json data. Also from back-end it comes in enum format and I need it to parse accordingly 1 for Male and 2 for Female
here is the format of my back-end data,
{
"salesPersonId": 13,
"name": "testName",
"gender": 1,
"phone1": "34986215",
"phone2": "string",
"email": "[email protected]",
"team": "Bravo",
"teamLeader": "Delta",
"countyId": 1,
"county": null,
"subCountyId": 1,
"subCounty": null,
"address": "House 108",
"additionalInfo": "He Drinks tea",
"input1": "string",
"input2": "string"
}
and here's what I'm trying to get it bind with my received data,
<mat-form-field appearance="outline" fxFlex="33" class="pr-4">
<mat-label>Gender</mat-label>
<mat-select formControlName="gender">
<mat-option value="1">1</mat-option>
<mat-option value="2">2</mat-option>
</mat-select>
</mat-form-field>
neither it produces any error nor do it pre-select the gender tag that comes from back-end. Note: I'm using reactive forms Thanks in advance.