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

Switch with icon #22

Closed chelaruc closed 6 years ago

chelaruc commented 6 years ago

Hi,

Have you implemented a switch icon instead of text? I really need this in my projects. Here is an example: screen shot 2017-11-09 at 13 07 41

Regards, Ciprian

JulioWar commented 6 years ago

Hi @chelaruc

No, I don't have an implementation yet. but i can try to do something quickly.

Give me a moment.

JulioWar commented 6 years ago

Hello @chelaruc

I made the changes, now is possible to pass html for the properties switch-off-text and switch-on-text and you can use it like this:

With a varible

Component

...
class ComponentName {
     icon: string = '<i class"icon icon-trash">'
}

View

<bSwitch
                  [switch-on-text]="icon"
                  [switch-off-text]="icon"
                ></bSwitch>

or just defining it in the view

<bSwitch
                  switch-on-text="<i class'icon icon-trash'>"
                  switch-off-text="<i class'icon icon-cog'>"
                ></bSwitch>

Just update the library.

chelaruc commented 6 years ago

@JulioWar Thank you!