Complex ion-item doesn't pass ng-class onto innerElement

In the example code, clicking an item adds the selected class to an <ion-item>. However, the HTML has an inner <a> tag, which does not change in response to clicks. As a result, the background-color defined in the CSS is always white.

My expected behavior is that the classes specified in my ng-class definition would be applied to the whole HTML tree added for my <ion-item>.

You can change your css. Inspect the element and figure out exactly what rules you need to apply.

.selected a.item-content {
  background: lightcoral;
}

Just be sure your css selector is specific enough to overwrite the defaults.

1 Like