Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created October 7, 2022 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetanelBasal/970668b30faf085f7b09f69bb985dbcb to your computer and use it in GitHub Desktop.
Save NetanelBasal/970668b30faf085f7b09f69bb985dbcb to your computer and use it in GitHub Desktop.
const userControl = this.fb.control('', Validators.required);
const groupControl = this.fb.control('', Validators.required);
const $case = this.assignee?.get('$case');
$case?.valueChanges.pipe(startWith($case.value)).subscribe(($case) => {
clearOneOf(this.assignee);
this.assignee.addControl(
$case,
$case === 'userId' ? userControl : groupControl
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment