forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
dccbe41
commit e8d558d
Showing
2 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters