Alexander Bondarenko
Alexander Bondarenko

Reputation: 207

Bootstrap vs ng-class

I use bootstrap to create a table, but if there is some value in a row I change background with ng-class`s help but the priority of bootstrap doesn't give me to do it, what shall I do? Sorry if my English is not so well)

<tr ng-repeat-start="objs in Objects" ng-click="param=!param" ng-class='{red : objs.state == "Rejected"}'>

Upvotes: 1

Views: 342

Answers (2)

Arun P Johny
Arun P Johny

Reputation: 388316

You can change the rule to a more specific one using specificity rules

.table-striped > tbody > tr.red td, .red {
    background-color: #ff0000;
}

Demo: Fiddle

Upvotes: 2

Guilherme Rodrigues
Guilherme Rodrigues

Reputation: 2844

You are almost there! You can simply copy the code from Bootstrap, adding your red selector:

.table-striped > tbody > tr:nth-of-type(odd).red { 
  background-color: #FF2222;
}

This will ensure that your selector is more specific than Bootstrap's, overriding it.

Read more about CSS Specificity: http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/

Upvotes: 1

Related Questions