-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Description
Bug
Currently if you set a default value for a slide-toggle it'll emit a ngModelChange event when the view inits, IMO the correct behavior would be to not emit this event since there was no change at all.
What are the steps to reproduce?
http://plnkr.co/edit/imQpobzGdi3Xl6IbXYo7?p=preview
Or use the component below:
import { Component } from '@angular/core';
@Component({
selector: 'demo-app',
template: `
<md-slide-toggle [(ngModel)]="test" (ngModelChange)="change()"></md-slide-toggle>
<hr>
<div [hidden] = "hide_msg">
Change event was received:
</div>
`
})
export class AppComponent {
hide_msg: boolean = true;
test = true;
change() {
this.hide_msg = false;
}
}
Which versions of Angular, Material, OS, browsers are affected?
All browsers and Angular versions...
Even changing test to 1
the event will also be fired...
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgent