1

Job add view

I want to fill up the heart icon color to red when a condition is true otherwise it'l be as blank.. i have used material design as follow

<md-button class="md-icon-button md-primary" aria-label="Settings" ng-click="checkShortList(shortListLoad.id)">
   <md-icon md-font-icon="icon-favorite-outline"></md-icon>
</md-button>

How to solve this context? i'm newbie to material design. Thanks you.

user3391137
  • 431
  • 8
  • 26

1 Answers1

0

I'm assuming you're using the Angular Material Icons

You can just change the class from icon-favorite-outline to icon-favorite

With angular you can use ngBindHtml to change a class based on a condition

Edit On further research I think this is perhaps a more elegant solution to changing class.

You just need to bind a variable into the directive "ng-class" and change it from the controller.

.

Community
  • 1
  • 1