Angular2 and BootStrap-Toggle

I am trying to use Bootstrap-Toggle in an Angular2 project and I cannot get it to work.

I did some debugging and I see it correctly, but after initialization starts, it goes back to the normal checkbox.

It looks like the problem is with Bootstrap-Toggle adding elements directly to the DOM.

How can I get Bootstrap-Toggle to work in Angular2?

Bootstrap-Toggle checkbox

+3


source to share


1 answer


you need to initialize it with java script like this in ngOninit () in your component relative to this template



ngOninit(){
  $("#toggleId").bootstrapToggle();
}

      

+1


source







All Articles