JulioWar / jw-bootstrap-switch-ng2

Bootstrap Switch for Angular 2+
https://juliowar.github.io/jw-bootstrap-switch-ng2/
MIT License
43 stars 14 forks source link

Not working properly in Angular CLI with angular 4 #12

Closed Sathishchary closed 7 years ago

Sathishchary commented 7 years ago

Hi

I have added this plugin in my Angular CLI project. I am able to see the UI of the switch, And the button is enabling and disabling when i drag the 'ON' to 'OFF', but if I click on the 'ON' or 'OFF', its not showing anything, and not working correctly, In the DEMO it's working for the drag and click.

Added like this in app.module file: import { JWBootstrapSwitchModule } from 'jw-bootstrap-switch-ng2'; imports : [JWBootstrapSwitchModule ]

component : export class SwitchComponent implements OnInit { public labelText: string = ""; public inverse: boolean = false; public baseClass: string = "bootstrap-switch"; public onText: string = "ON"; public offText: string = "OFF"; private _onColor: string = "primary"; private _offColor: string = "default"; public calldisabled: boolean = false; public callreadonly: boolean = false; public size = 'normal'; callanimate = true; constructor() { } enableAction(event: any){ console.log(event); } }

html code: <bSwitch [switch-base-class]="baseClass" [switch-wrapper-class]="wrapperClass" [switch-off-text]="offText" [switch-on-text]="onText" [switch-on-color]="_onColor" [switch-off-color]="_offColor" [switch-size]="size" [switch-disabled]="calldisabled" [switch-readonly]="callreadonly" [switch-animate]="callanimate" formControlName="callACtion" (onChangeState)="enableAction($event.currentValue)">

JulioWar commented 7 years ago

Hello @Sathishchary what version of this library and angular CLI are you using ?

Sathishchary commented 7 years ago

@JulioWar I am using below versions: "jw-bootstrap-switch-ng2": "^1.0.4", angular/cli: 1.0.0 angular : 4.0.0

JulioWar commented 7 years ago

@Sathishchary

I can't see something wrong in your code, just a few things like:

But a I don't think those things are the problem.

This is the repository for the demo if you want to check it : https://github.com/JulioWar/jw-bootstrap-switch-demo.

If you can replicate the issue in a isolate respository or something like that and I can check it.

Sathishchary commented 7 years ago

Thanks for the demo @JulioWar , I have download it ,its working, I have compared the demo code with my code. the problem with my css only. its overriding some check box css. I removed that, now its working perfectly.