title: create some adaptor to match the 3rd party inputs and outputs
body: <p>I have one 3rd party component that accepts array[object] in ngModel and does changes in that. I'm using it for just single value, so I want it just to accept object.<a href="https://i.stack.imgur.com/4GsvF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4GsvF.png" alt="enter image description here" /></a></p>
  <p>I have written a component with <code>ControlValueAccessor</code>. That makes change input and output. its an Autocomplete select. The problem here is when I select something write value called with null and then with the object(And sometimes infinite loop that kills the page). I don't want to call writevalue while user is selecting.
  Here is my component looks like</p>
  <pre><code>&lt;sky-input-box&gt;
      &lt;label *ngIf=&quot;label&quot; class=&quot;sky-control-label&quot;&gt;
          {{label}}
      &lt;/label&gt;
      &lt;sky-lookup 
          selectMode=&quot;single&quot; 
          [propertiesToSearch]=&quot;propertiesToSearch&quot;
          [search]=&quot;search()&quot;
          [searchResultTemplate]=&quot;searchResultTemplate&quot; 
          [descriptorProperty]=&quot;descriptorProperty&quot; 
          [attr.name]=&quot;name&quot;
          [attr.id]=&quot;id&quot; 
          [(ngModel)]=&quot;value&quot; 
          (ngModelChange)=&quot;modalChange($event)&quot;&gt;
      &lt;/sky-lookup&gt;
  &lt;/sky-input-box&gt;
  
  export class LookupSingleModeComponent implements OnInit, ControlValueAccessor {
      constructor() { }
      @Input() label?: string;
      @Input() searchFilters: any;
      @Input() propertiesToSearch: string[];
      @Input() search: any;
      @Input() searchResultTemplate: any;
      @Input() descriptorProperty: string;
      @Input() name: string;
      @Input() id: string;
      value: any[];
      ngOnInit(): void { }
  
      writeValue(obj: any): void {
          this.value = obj ? [obj] : [];
      }
  
      registerOnChange(fn: any): void {
          this.onChange = fn;
      }
  
      registerOnTouched(fn: any): void {
          this.onTouched = fn;
      }
  
      setDisabledState?(isDisabled: boolean): void {
      }
  
      onChange: any = () =&gt; { };
      onTouched: any = () =&gt; { };
  
      modalChange: any = () =&gt; {
          this.onChange(Array.IsArray(this.value) ? this.value[0] : undefined);
      }
  }
  
  
  ``
  </code></pre>