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...