1 import { Component, forwardRef, Input } from '@angular/core'
2 import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
5 selector: 'my-select-custom-input',
6 styleUrls: [ './select-custom-input.component.scss' ],
7 templateUrl: './select-custom-input.component.html',
10 provide: NG_VALUE_ACCESSOR,
11 useExisting: forwardRef(() => SelectCustomInputComponent),
16 export class SelectCustomInputComponent implements ControlValueAccessor {
17 @Input() items: any[] = []
27 propagateChange = (_: any) => { /* empty */ }
29 writeValue (id: number) {
33 registerOnChange (fn: (_: any) => void) {
34 this.propagateChange = fn
37 registerOnTouched () {
42 this.propagateChange(this.selectedId)