title: ngx-formly ng-select formcontrol change emitted value
body: <p>I have a formly form with a custom typeahead field using ng-select multi select. It currently emits an array of key value pairs. I need it to emit an array of just values. Seems like this should be a roughly straight forward task but I'm struggling to figure out out to do it. Will post updates as I try different things. I can build a helper to intercept the model and reformat it but there must be  clean way to do that within the formcontrol.</p>
  
  <p>typeahead.component.ts</p>
  
  <pre><code>@Component({
    selector: 'app-kup-typeahead',
    template: `
      &lt;ng-select
        [items]="options$ | async"
        [ngClass]="{'ng-select-required': to.required}"
        [placeholder]="to.label"
        [typeahead]="search$"
        [formControl]="formControl"
        [multiple]="to.multiple"
        (change)="onChange($event)"
      &gt;
      &lt;/ng-select&gt;
    `,
  })
  export class KupTypeaheadComponent extends FieldType implements OnInit, OnDestroy {
    onDestroy$ = new Subject&lt;void&gt;();
    search$ = new EventEmitter();
    options$;
  
    ngOnInit() {
      this.options$ = this.search$.pipe(
        takeUntil(this.onDestroy$),
        startWith(''),
        filter(v =&gt; v !== null),
        debounceTime(200),
        distinctUntilChanged(),
        switchMap(this.to.search$),
      );
  
      this.options$.subscribe();
    }
  
    ngOnDestroy() {
      this.onDestroy$.complete();
    }
  
    onChange(item: any) {
      console.warn('onChange ', item);
    }
  }
  </code></pre>
  
  <p>form-config.ts</p>
  
  <pre><code>   {
        key: 'genotype.ploidy',
        id: 'filter_ploidy',
        type: 'kup-typehead',
        templateOptions: {
          label: 'Filter by Ploidy',
          multiple: true,
          options: of(res['creation_method']),
          search$: (term: string) =&gt; {
            return this.dropdownService.getDropdown('genotypes/ploidies', '', '', term);
          }
        }
      }
  </code></pre>