Questions tagged [angularjs-ng-class]

The ngClass directive allows you to dynamically set CSS classes on an HTML element by databinding an expression that represents all classes to be added.

63 questions
6
votes
2 answers

How to add and remove class with AngularJS?

I have a few buttons that work like switchers. If you click one it becomes active and "shuts down" other buttons. I did this using jQuery but would like to use AngularJS. Here is my code: HTML
6
votes
3 answers

Add a class selectively to an ng-repeat AngularJS

I have an ng-repeat for a table, I want to be able to add a class when is clicked, and remove the class when un-clicked. Multiple can be selected at the same time. Right now ALL of the cities are or are not getting the class applies. For…
user1876246
  • 1,219
  • 5
  • 18
  • 33
3
votes
1 answer

AngularJS ng-class Expression Not Working Properly?

I am using ng-repeat to list out the number of home runs vs away run in a simple table. I am applying a class based on which team is winning using the following snippet of code:
Eoghan Buckley
  • 155
  • 1
  • 4
  • 15
3
votes
1 answer

how to get ng-class value in directive

I have some repeated 'li' elements, and some of them has 'active' class like this
  • in the othe hand, I have a directive to…
  • 3
    votes
    3 answers

    angularjs show/hide tabs, click same tab hide the content

    when i click tab A, A content show when i click tab B, A content hide B content show but the effect i want is when i click tab A, A content show, click A tab again content hide. Any suggest will be help thanks
    3
    votes
    3 answers

    How to use $index to change class in ng-repeat?

    I have a list which is limited to 3 items, the first item needs class blue1, 2nd needs blue2, 3rd blue3.
    • {{tag.term}}
    Leon Gaban
    • 36,509
    • 115
    • 332
    • 529
    3
    votes
    1 answer

    How to use ng-toggle and ng-class to change icon while using ng-click:predicate

    I'm using predicate to easily sort items in my data model. Now I've working on adding in an up and down arrow icons to show which state the sort is currently in. Example of predicate orderBy in action: http://plnkr.co/edit/?p=preview Not sure how…
    Leon Gaban
    • 36,509
    • 115
    • 332
    • 529
    3
    votes
    2 answers

    addclass if search field has value: Angularjs

    I have a search input field and a listbox,