Skip to content

ChangeDetectionStrategy.OnPush breaks ControlValueAccessor functionality #12607

Closed

Description

@mseemann
[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

If a ControlValueAccessor component is used as a child of a component with it's ChangeDetectionStrategy is set to OnPush the current value is always one change behind.

Expected behavior

If a ControlValueAccessor component is used as child of a component with it's ChangeDetectionStrategy is set to OnPush it should work exactly as if the ChangeDetectionStrategy is set to Default.

Minimal reproduction of the problem with instructions

Plnkr http://plnkr.co/edit/1WboKWCqmPZFF8DOBfsd?p=preview. Click on the Button Push Changes. As you can see the red bordered input control did not reflect the current value. Please note: the blue bordered control is the same component type - but is used as a child of a component with ChangeDetectionStrategy.Default.

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

Custom Controls are not working as childs of components with ChangeDetectionStrategy.OnPush

  • Angular version: 2.0.X

    2.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

    all

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    TypeScript

  • Node (for AoT issues): node --version =
    v5.10.1

Activity

  1. DzmitryShylovich commented on Oct 29, 2016

    @DzmitryShylovich
    Contributor

    Duplicate of #10816

  2. mhevery commented on Dec 13, 2017

    @mhevery
    Contributor

    closing as dup

  3. 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.

  4. 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