[SOLVED]Ion-toggle within clickable list



I am using ionic for a project and was wondering if it would be possible to have a toggle and a link on the same list item, for example:

       <div class="list">
            <a class="item" ng-click="blah()">
               <ion-toggle toggle-class="toggle-assertive">This is a test, does it work?</ion-toggle>

I have tried this and it makes the toggle unclickable as it just activates the <a><a/> tag when clicked


Yup, you just have to override some css defaults and reformat you markup

<ul class="list">
  <ion-toggle toggle-class="toggle-assertive">
    <a ng-click="blah()">
      this is with ion-toggle
  <li class="item item-toggle">
    <a ng-click="blah()">
      this is with pure css
    <label class="toggle toggle-assertive">
      <input type="checkbox">
      <div class="track">
        <div class="handle">


Thanks, i’ll give it a go :slight_smile:


I see with this example that the click only happens when you click the text, do you think it would be possible to have it when the list item itself is clicked and just not the text? For example when you use <a class="item">Some Text</a> it will display a chevron on the right and the whole item is clickable and not just the text.


Updated the codepen, You just need to add this to the a tags

a {
  display: block;
  width: 100%;


Thanks @mhartington :slight_smile:


thx for the solution! - when trying it out in my own code at device - the a link text remained not ‘click able’ - maybe its worth to clarify that for others link me - its this css thats requires otherwise the “.item-toggle” will prevent the text to be click able:

  pointer-events:initial !important;

why is this not just part of ionic by default?