Skip to content

Instantly share code, notes, and snippets.

@v-skochko
Last active September 10, 2020 14:40
Show Gist options
  • Select an option

  • Save v-skochko/7ae621ab8184668b798f595a86de6276 to your computer and use it in GitHub Desktop.

Select an option

Save v-skochko/7ae621ab8184668b798f595a86de6276 to your computer and use it in GitHub Desktop.
// get control inside form group
this.form.get('reminder').get('reminderDateTime').disable();
//disable nested form control by index
for (let i = 0; i < this.PARENT.NESTED.length; i++) {
this.dependentForm.at(i)['controls']['CONTROLNAME'].disable();
}
// Remove and set validators to nested forms
this.locationsForm.at(i).get('CONTROLNAME').clearValidators();
this.NESTEDFORM.at(i).get('CONTROLNAME').setValidators([Validators.required]);
this.NESTEDFORM.at(i).get('CONTROLNAME').updateValueAndValidity();
// Subscribe to nested form field
for (let index = 0; index < this.form.value.teachers.length; index++) {
this.teachersForm.at(index).get('clientId').valueChanges.pipe(
takeUntil(this._unsubscribeAll),
debounceTime(100)
).subscribe(val => {
this.newChangeDetected(val, index);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment