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

Class MyInput

packages/forms/test/value_accessor_integration_spec.ts:2142–2169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

OutputInterface · 0.90

Tested by

no test coverage detected