'unable to fetch selected value in angular dropdown using custom library select

Unable to get selected value in dropdown which is using select input from the custom library. The input fields are in a popup where the required inputs are given and submitted. after closing popup and reopening the values should be retained, but in my case all the input field values are retaining except for select dropdown. Can somebody help?

component.ts

     codes$ = this.dataSvc.getCodes().pipe(map(data=> value.map(value=> (<SelectItem>{ key: value.shortcode, value: value.shortcode })).sort((a, b) => a.key.localeCompare(b.key))));

ngOnInit() {this.reset();}

setDirty() {this.form.dirty = true;}

reset() {this.form.dirty = false;this.form.keys.forEach(key => {this.form.fields[key] = this.popupData[key];});}

    saveForm() {this.form.keys.forEach(key => {this.popupData[key] = this.form.fields[key];});this.form.dirty = false;this.updateData.emit();}

component.html

<div class="m-y-2">
    <div class="m-b-2">
      <custom-label>{{'Code' | translate}}</custom-label>
      <custom-select
        [disabled]="disabled"
        [options]="codes$ | async"
        [canUnselect]="true"
        [(value)]="form.fields.zipCode"
        (valueChange)="setDirty()"
        placeholder="{{'Select' | translate}}"
      ></custom-select>
  </div>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source