Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save realtomaszkula/9c55d7325ff0b89142d9fad01c19a00d to your computer and use it in GitHub Desktop.
Save realtomaszkula/9c55d7325ff0b89142d9fad01c19a00d to your computer and use it in GitHub Desktop.
reactiveRange() {
const startCtrl = this.form.get('rangeStart');
const endCtrl = this.form.get('rangeEnd');
startCtrl.valueChanges
.pipe(filter(v => v > endCtrl.value))
.subscribe(v => endCtrl.setValue(v));
endCtrl.valueChanges
.pipe(filter(v => v < startCtrl.value))
.subscribe(v => startCtrl.setValue(v));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment