MCPcopy Create free account
hub / github.com/angular/angular / MyInput

Class MyInput

packages/forms/test/value_accessor_integration_spec.ts:2191–2218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2189 standalone: false,
2190})
2191export class MyInput implements ControlValueAccessor {
2192 @Output('input') onInput = new EventEmitter();
2193 value!: string;
2194
2195 control: AbstractControl | null = null;
2196
2197 constructor(public controlDir: NgControl) {
2198 controlDir.valueAccessor = this;
2199 }
2200
2201 ngOnInit() {
2202 this.control = this.controlDir.control;
2203 }
2204
2205 writeValue(value: any) {
2206 this.value = `!${value}!`;
2207 }
2208
2209 registerOnChange(fn: (value: any) => void) {
2210 this.onInput.subscribe({next: fn});
2211 }
2212
2213 registerOnTouched(fn: any) {}
2214
2215 dispatchChangeEvent() {
2216 this.onInput.emit(this.value.substring(1, this.value.length - 1));
2217 }
2218}
2219
2220@Component({
2221 selector: 'my-input-form',

Callers

nothing calls this directly

Calls 1

OutputInterface · 0.90

Tested by

no test coverage detected