ovsleep / bootstrap-switch

This is a Angular 2 Component to add a switch like input.
https://bootstrap-switch.herokuapp.com/
8 stars 10 forks source link

Cannot read property 'toString' of undefined at SwitchComponent.webpackJsonp.../../../../angular2-bootstrap-switch/lib/switch.component.js.SwitchComponent.ngOnChanges #12

Closed AbGrS closed 7 years ago

AbGrS commented 7 years ago

The code breaks at the initial loading in method: "SwitchComponent.prototype.ngOnChanges"

the reason is, ngOnChanges fires during the initial loading and at that time 'value' in the method is undefined : var value = changedProp.currentValue;

Please fix this

AbGrS commented 7 years ago

Sorry my bad I wasn't passing this config:

name:string; value:boolean=true; onText='ON'; offText='OFF'; onColor="green"; offColor="red";