components icon indicating copy to clipboard operation
components copied to clipboard

md-select : onSelect emitted before ngModel updated

Open nadavten opened this issue 9 years ago • 5 comments

beta-1 BUG: onSelected is emitted before the model (ngModel) updated , not showing the current state of the model.

nadavten avatar Feb 07 '17 22:02 nadavten

@nadavten Can you clarify your use case? In most cases, you shouldn't need to use ngModel and onSelect together (there should be one source of truth for value changes). Typically in that case you'd want (ngModelChange).

kara avatar Feb 08 '17 00:02 kara

i want to update my model property and update some other model properties depending on that model. i didnt know there 'ngModelChanged' in md-select. and if there is it makes me wonder why there is 'onSelect' ?

On Wed, Feb 8, 2017, 02:04 Kara [email protected] wrote:

@nadavten https://github.com/nadavten Can you clarify your use case? In most cases, you shouldn't need to use ngModel and onSelect together. Typically in that case you'd want (ngModelChange)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/angular/material2/issues/2972#issuecomment-278185634, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ-rrC9oWn_UYeqle6_FRh8caJFF9cJqks5raQZ0gaJpZM4L6HFH .

nadavten avatar Feb 08 '17 05:02 nadavten

ngModelChanged is simply a part of @angular/forms intergration. onSelect is there if you need to use md-select without @angular/forms.

fxck avatar Feb 08 '17 07:02 fxck

As @fxck mentioned, ngModelChange is part of the Angular core FormsModule. Select just integrates with it. You can use onSelect if you aren't using one of the forms modules, but they aren't intended to be used together in this way. As there is already a recommended way to get your use case working, I'm going to close this.

kara avatar Feb 08 '17 17:02 kara

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.