RC6 Forms: when value is null, control is not disabled
See original GitHub issueI’m submitting a bug (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
form = new FormGroup({
'first': new FormControl({value: null, disabled: true}, Validators.required),
'last': new FormControl('Drew', Validators.required)
})
the control first
will not be disabled
Expected/desired behavior
first
shall be disabled because disabled
is true, even so the input is null. If the value is empty (‘’), it will not be disabled either. In other words, the input seems disabled only, and only if the input has a value
defined
Reproduction of the problem
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
- Angular version: 2.0.0-rc.6
- Browser: [ Chrome 52 ]
- Language: [ TypeScript ]
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to disable form control but keep value - Stack Overflow
Assuming you have a disabled property in your component. You have to retun null not false to enable the input. Share.
Read more >Angular2 RC6 disabled input – iTecNote
After upgrading to Angular2 RC6 I'm getting the following message in the ... form = new FormGroup({ first: new FormControl({value: 'Nancy', disabled: true}, ......
Read more >Exploring the difference between disabling a form control ...
Our form's value will not sync with our application state store because when the observer executes, it will find that the form's status...
Read more >ng-dynamic-forms documentation
6, Angular does not allow property bindings of the disabled attribute in reactive forms. Yet updating either the value or status of a...
Read more >Disabling Form Controls When Working With Reactive Forms ...
You can enable/disable a form control by using the following ways: Instantiate a new FormControl with the disabled property set to true. FormControl({value:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Krisa We were running the disabled check too late. Should be fixed by #11257.
Oh hey. That’s pretty weird. So if you put value as null and the control is disabled and you have the required validator, something is going wrong. I’ll look into it!