AbsaOSS / AbsaOSS/cps-shared-ui

Support built-in disabling mechanism for reactive form controls instead of applying disabled attribute

Open
#309 0 comments 0 reactions 0 assignees View on GitHub
enhancement library
Dominant language
TypeScript
Stars
9
Forks
6
Avg merge
23h 46m
Merged PRs (30d)
5

Description

```
It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
you. We recommend using this approach to avoid 'changed after checked' errors.

Example:
// Specify the `disabled` property at control creation time:
form = new FormGroup({
first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
last: new FormControl('Drew', Validators.required)
});

// Controls can also be enabled/disabled after creation:
form.get('first')?.enable();
form.get('last')?.disable();
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.