I need help with concatenating two fields, but the issue arises when the second field is missing. Specifically, the group.GroupDescription
field may not be present in some entries. Is there a way to concatenate both fields only if the second field group.GroupDescription
exists?
Please note that I have also attempted using the safe navigation operator, but it returns null if the value is not present.
Thank you in advance for your assistance.
<select
[(ngModel)]="selectedGroup"
class="form-control"
(ngModelChange)="onChange($event)"
>
<option [ngValue]="undefined" selected>Select</option>
<option *ngFor="let group of groups" [ngValue]="group">{{
group.GroupName.S + ' - ' + group.GroupDescription?.S
}}</option>
</select>