Skip to content

Enable a reactive form using the FormControlDirective #20008

Closed

Description

@sgkazakov

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[] Bug report  
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Currently the FormControlDirective can't handle disabled property change from true to false.

Expected behavior

The FormControlDirective will update the control disabled property from true to false.

Minimal reproduction of the problem with instructions

https://plnkr.co/edit/hIg6qdPcwqykc1K6jRUd?p=preview

  1. Click on the button.
  2. The FormControlDirective will update the control disabled property from false to true.
  3. Click it button again.
  4. The FormControlDirective will NOT update the control disabled property from true to false.

What is the motivation / use case for changing the behavior?

I would like to be able to use the FormControlDirective to set the disabled property of a control from true to false.

Environment


Angular version: 4.4.6


Browser:
- [x] Chrome (desktop) 62.0.3202.75 (Official Build)
- [x] IE version 11.15.16299.0
- [x] Microsoft Edge 41.16299.15.0

Activity

  1. trotyl commented on Oct 30, 2017

    @trotyl
    Contributor

    Not related to NgFor, currently FormControlDirective won't respect disabled property change from true to false, since 2b313e4#diff-cae4150234e5b06ff9cd24d7f7d6f294 only handles the condition from false to true for FormControlDirective.

    The problem can be identified easily in code: form_control_directive.ts#L91-L93

  2. changed the title [-]Can't enable a reactive form input in a trackedBy ngFor.[/-] [+]Can't enable a reactive form using FormControlDirective[/+] on Oct 30, 2017
  3. changed the title [-]Can't enable a reactive form using FormControlDirective[/-] [+]Enable a reactive form using the FormControlDirective[/+] on Oct 30, 2017
  4. sgkazakov commented on Oct 30, 2017

    @sgkazakov
    Author

    @trotyl Thank you. I've updated the issue and the plunker.

  5. trotyl commented on Nov 16, 2017

    @trotyl
    Contributor

    Found it was duplicate of #17806.

  6. dzonatan commented on Nov 23, 2017

    @dzonatan
    Contributor

    The fix is hanging in #18575 ... don't know how to get attention there.

  7. kara commented on Jan 23, 2018

    @kara
    Contributor

    Looks like a duplicate

  8. angular-automatic-lock-bot commented on Sep 13, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  9. locked and limited conversation to collaborators on Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions