Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[(ngModel)] binding breaks if template includes specific element #13886

Closed
AsherBarak opened this issue Jan 12, 2017 · 7 comments
Closed

[(ngModel)] binding breaks if template includes specific element #13886

AsherBarak opened this issue Jan 12, 2017 · 7 comments

Comments

@AsherBarak
Copy link

AsherBarak commented Jan 12, 2017

I'm submitting a ... (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

Observed behavior
When implementing ControlValueAccessor and including md-select (from angular-material2) in the template ControlValueAccessor methods are not invoked and banana-binding does not work.

Desired behaviour
When implementing ControlValueAccessor and including md-select (from angular-material2) in the template ControlValueAccessor methods are invoked and banana-binding works.

Steps to reproduce
This plunker contains tow identical components where the only difference is the inclusion of md-select in the template of 'with-select' component. This brakes banana binding as described.

  1. Open plunker at http://plnkr.co/edit/BzgXV2?p=preview
  2. Watch console and note logs for all events emitted from ControlValueAccessor methods on no-select component:
    image
    writeValue(obj: any): void {
      this.val=obj;
                console.log('no-select writeValue: ' + obj);
          };

    registerOnChange(fn: any): void {
        console.log('no-select on change registered');
        this.onChange = fn;
    };

    registerOnTouched(fn: any): void {
      console.log('no-select on touched registered');
        this.onTouched = fn;
    };
  1. Note app.component includes both no-select and with-select components:
    image
    Where the only differences is that with-select has md-select in it's template:
    image
    and yet all ControlValueAccessor methods calls for the with-select component are missing from the log (and binding is not functioning).

See also
angular/components#2609

@DzmitryShylovich
Copy link
Contributor

Pls add:

  1. steps to reproduce
  2. observed vs desired behaviour

@AsherBarak
Copy link
Author

Added to original ^

@mhevery
Copy link
Contributor

mhevery commented Jan 13, 2017

Please include instructions as to where do I click, what should I see, what should happen, otherwise we spend too much time reverse engineering your intent.

@AsherBarak
Copy link
Author

Hi @mhevery,
Thanks for looking into this. Added as much details as I could to original issue description above^. The problem is with something not happening so it is a bit trickier to document.

@jelbourn jelbourn changed the title [(ngModel)] binding brakes if template includes specific element [(ngModel)] binding breaks if template includes specific element Jan 17, 2017
@jelbourn
Copy link
Member

@kara can you take a look at this?

@kara
Copy link
Contributor

kara commented Jan 17, 2017

@AsherBarak Thanks for reporting! This is a bug in md-select, so I'll close this in core and retain the existing issue in the material2 repo, angular/components#2609.

@kara kara closed this as completed Jan 17, 2017
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants