-
-
Save tanepiper/fe0dec59abc53f9c34941a499b7d45d3 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