ed4becky
ed4becky

Reputation: 1630

md-autocomplete and ng-class

I would like to style the first 10 items in an autocomplete list to have a green background.

I tried adding ng-class to the md-autocomplete element, but it didn't seem to "take"

  1. does md-autocomplete support ng-class?

  2. any suggestions on how I might accomplish my goal?

Upvotes: 0

Views: 1229

Answers (2)

camden_kid
camden_kid

Reputation: 12813

Here you go - CodePen

Markup (relevant)

<md-item-template>
    <span md-highlight-text="ctrl.searchText" md-highlight-flags="^i" ng-class="{greenBackground: $index<=9}">{{item.display}}</span>
</md-item-template>

CSS

.greenBackground {
  background: green;
}

Upvotes: 3

Matheno
Matheno

Reputation: 4152

As seen in the documentation you can use md-menu-class to style the dropdown menu.

Upvotes: 1

Related Questions