javascript - Material Design Slide Toggle does not have event.StopPropagation, what should I use? -


the slide toggle in material design not have stoppropagation event, because "mdslidetoggle.prototype._onchangeevent" calls stoppropagation. should using, instead?

<md-slide-toggle (change)="changetoggle($event, activitytype.isactive)" checked="activitytype.isactive" value="activitytype.activitytypeid" mdtooltip="{{!!activitytype.isactive ? 'active' : 'inactive'}}" mdtooltipposition="left"></md-slide-toggle>   public changetoggle(event: mdslidetogglechange, originalvalue){     if (this.haschange && event.checked !== originalvalue){         event.stoppropagation();         //results in error: [ts] property 'stoppropagation' not exist on type 'mdslidetogglechange'.     } else {         this.haschange = !this.haschange;     } } 

i can use regular event, gets exception saying "event.stoppropagation not function".

for moment, i'm changing line to:

event.source.checked = !event.checked; 

the same true of event.preventdefault. need require user save change, before changing value on page, because "business requirements".

is changing value of "checked" was, right thing do? there better way this?


Comments