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

fix(input): properly determine input value #2455

Merged
merged 3 commits into from
Jan 4, 2017

Commits on Jan 4, 2017

  1. fix(input): properly determine input value

    Right now the `MdInputDirective` tries to cache the `value` of the input.
    
    To do this, the `MdInputDirective` needs to listen for `NgControl` value changes and for native `(change)` events.
    
    This will be problematic when a value is set directly to the input element (using `[value]` property binding) because Angular is only able to recognize this change in the first ChangeDetection.
    
    ```html
    <md-input-container>
      <input md-input [value]="myValue" placeholder="Label">
    </md-input-container>
    ```
    
    The approach of updating the value in the `ngAfterViewInit` lifecycle hook, will result in a binding change while being in a ChangeDetection, which leads to a ChangeDetection error.
    
    ```
    Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.
    ```
    
    Fixes angular#2441. Fixes angular#2363
    devversion committed Jan 4, 2017
    Configuration menu
    Copy the full SHA
    02e5cea View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a9c3bb2 View commit details
    Browse the repository at this point in the history
  3. Add better comment.

    devversion committed Jan 4, 2017
    Configuration menu
    Copy the full SHA
    778f709 View commit details
    Browse the repository at this point in the history