| 2137 | standalone: false, |
| 2138 | }) |
| 2139 | export class MyInput implements ControlValueAccessor { |
| 2140 | @Output('input') onInput = new EventEmitter(); |
| 2141 | value!: string; |
| 2142 | |
| 2143 | control: AbstractControl | null = null; |
| 2144 | |
| 2145 | constructor(public controlDir: NgControl) { |
| 2146 | controlDir.valueAccessor = this; |
| 2147 | } |
| 2148 | |
| 2149 | ngOnInit() { |
| 2150 | this.control = this.controlDir.control; |
| 2151 | } |
| 2152 | |
| 2153 | writeValue(value: any) { |
| 2154 | this.value = `!${value}!`; |
| 2155 | } |
| 2156 | |
| 2157 | registerOnChange(fn: (value: any) => void) { |
| 2158 | this.onInput.subscribe({next: fn}); |
| 2159 | } |
| 2160 | |
| 2161 | registerOnTouched(fn: any) {} |
| 2162 | |
| 2163 | dispatchChangeEvent() { |
| 2164 | this.onInput.emit(this.value.substring(1, this.value.length - 1)); |
| 2165 | } |
| 2166 | } |
| 2167 | |
| 2168 | @Component({ |
| 2169 | selector: 'my-input-form', |
nothing calls this directly
no test coverage detected
searching dependent graphs…