Last active
September 14, 2022 06:35
-
-
Save dmitry-stepanenko/e5d7b941ad8bdd5340de023089dfbfd2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... code of CounterComponent | |
writeValue(value: number) { | |
// it's convenient to reuse existing "setValue" method, right? | |
// however, this will lead to the incorrect behavior | |
this.setValue(value, false); | |
this._cdr.markForCheck(); | |
} | |
protected setValue(value: number, emitEvent: boolean) { | |
this.value = value; | |
if (emitEvent && this.onChange) { | |
this.onChange(value); | |
this.onTouched(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment