Last active
November 3, 2022 00:04
-
-
Save MarsiBarsi/52a2c10d955bbf7ce2475681c5b12c73 to your computer and use it in GitHub Desktop.
replay-control-value-changes.ts
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
export class ReplayControlValueChanges<T> extends Observable<T> { | |
constructor(control: AbstractControl | AbstractControlDirective) { | |
super(subscriber => { | |
if (!control.valueChanges) { | |
throw new Error('Control does not have valueChanges'); | |
} | |
control.valueChanges.pipe(startWith(control.value)).subscribe(subscriber); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment