[RESOLVED] Ion-toggle directive and label toggle class swipe effect

Hello,

On this codepen : http://codepen.io/anon/pen/njeDt
You can see two toggle with different comportement. The first one detect the “swipe” event, but not the second one.

Unfortunately, in my project, I want to use the second solution (because it’s not on a list) and I also want that my label detect the swipe effect (by the fact, I really do not understand why ionic directive are always embeded on a kind of “list component”).

How can I can achieve that ?
Thanks

In ionic bundle.js, I changed directly the ionic directive by removing the item class of the root div of the template, but I want to know if there is a better solution to do that…

I think a best solution is to create my own toggle directive based on the ionic one (https://github.com/driftyco/ionic/blob/master/js/angular/directive/toggle.js#L1) unfortunately I tried basically to take the code as it is and I have a undefined on forEach in it.

Any help ? Thanks.

I was able to abstract the template and create just a toggle directive.

1 Like

Thanks again mhartington, you’re amazing ! :wink:

Thanks @mhartington!

I tried to make flip toggle with yes/no text…

it’s work well. :smiley:

See the Pen ionic flip toggle by Tiemin Li (@tiemin) on CodePen.