I have a scenario where I have select dropdownlist(classification array). if my selecList has multiple values then ill display as a dropdown. if it has only one element in the array then by default it should be shown in selectList dropdown with that element selected by default. I need to write a condition where if classification element length is less orequal to 1 then show the element selected by default in matselect or display the list. Could you guys advise
<form [formGroup]="myForm">
<div formGroupName="Details">
<mat-form-field appearance="outline">
<mat-label class="required">Classification</mat-label>
<mat-select
formControlName="classification"
>
<mat-option
*ngFor="let type of classification"
[value]="type.definedCode"
>
{{ type.definedMessage }}
</mat-option>
</mat-select>
</mat-form-field>
TsFile
classification: any =[
{
"definedSetValueCode":"Dry",
"definedSetValueIntMessage":"Seco"
}
],