-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Open
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: inputs / outputsfreq1: lowtype: confusingworkaround1: obvious
Milestone
Description
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
Current behavior
Currently the order of (ngModelChange)
and [(ngModel)]
on an input element matters. In the following case the ngModelChange
callback is called before ngModel
updates the value of model:
<select (ngModelChange)="onModelChange()" [(ngModel)]="hero.name" >
<option>Dexter</option>
<option>Voltron</option>
</select>
The following however works fine:
<select [(ngModel)]="hero.name" (ngModelChange)="onModelChange()">
<option>Dexter</option>
<option>Voltron</option>
</select>
Expected/desired behavior
Not sure what the expected behavior should be or if this the intended behavior. But I think the order of attributes in an element should not matter.
Reproduction of the problem
Link to plunker: http://plnkr.co/edit/wrVrHYx3pPdLmCKz17RL?p=preview
Open up the console and select Hero name from the drop-down. Notice how the values are printed in console. Swap the order of ngModel
and onModelChange
and observe the difference.
- Angular version: 2.0.0-rc.5
- Browser: Chrome Version 52.0.2743.116 m
- Language: TypeScript
kemsky, numsu, MPVogelPaint, miller-time, nlaplante and 33 moresharikovvladislav, jirikyncl, derekparsons718, AmerAnsari and alinmateut
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functionsarea: coreIssues related to the framework runtimeIssues related to the framework runtimecore: inputs / outputsfreq1: lowtype: confusingworkaround1: obvious