Linked Questions

0 votes
1 answer
336 views

How to apply ng class with a condtion statement [duplicate]

I'm new to Angular js and was wondering how to make an ng class apply based on a set of conditions. For example i want to have a set of dates using ng repeat and change the colour of the date if that ...
Indrick's user avatar
  • 21
0 votes
0 answers
40 views

Angular - add class to button if on page [duplicate]

If the user is on the create-projects page I want to add a CSS class to the 'logo' button and remove it if its not on that page this is what I have currently. Does anyone know a way of doing this ...
NoDachi's user avatar
  • 954
-2 votes
1 answer
65 views

Set Class if json Array is 0 [duplicate]

I try to build a User bar like in Facebook "New Friend Requests" ore "New Pms" This is now my HTML Template Code: <li class="icon-element pms"> <div class="icon" ng-include="iconPm">&...
Sven Budak's user avatar
1203 votes
23 answers
783k views

What is the best way to conditionally apply a class?

Lets say you have an array that is rendered in a ul with an li for each element and a property on the controller called selectedIndex. What would be the best way to add a class to the li with the ...
respectTheCode's user avatar
116 votes
8 answers
144k views

How to filter (key, value) with ng-repeat in AngularJs?

I am trying to do something like : <div ng-controller="TestCtrl"> <div ng-repeat="(k,v) in items | filter:hasSecurityId"> {{k}} {{v.pos}} </div> </div> ...
Vural's user avatar
  • 8,746
3 votes
2 answers
3k views

How to use AngularJS ng-Class condition based on another element's class?

<div id="parent" ng-class="{testClass:???}"> <span id="child" class="test"/> </div> On this example, how would I do it so that if element child would have a class test, the parent ...
Albert Cruz's user avatar
2 votes
1 answer
7k views

Angular ng-class if length of array is less than X?

I need to conditionally add two classes using ng-class. I want to add class checked if case has commments, and I want to add class lots if the length of the comments array is more than 10. This ...
Ila's user avatar
  • 3,558
0 votes
3 answers
2k views

Add styles to a existing class with angular

I have many existing classes in my app and want to set the style via code (theming feature). e.g. <button class="mybutton">click</button> I need something like: <style> ....
daniel's user avatar
  • 35.9k
3 votes
3 answers
1k views

Setting class values in Angular template

I'm a bit of an Angular novice an I'm struggling with something I thought would be very simple. I have a template that is used in a read only version of a form in my app. This template displays a ...
RussK's user avatar
  • 33
1 vote
1 answer
1k views

Conditionally apply boot strap columns with ng-class

I am trying to use col-sm-9 when a flag is set to false, and col-sm-5 when it is set to true. I'm trying this <div ng-class="{col-sm-9: !flag, col-sm-5: flag" class="col-sm-offset-3}"></div&...
Zach's user avatar
  • 650
0 votes
2 answers
2k views

Angular set :active selector of CSS by ng class

I would like to set the className:active selector by ng-class like so: ng-class='{"className:active" : true}'
h. Oo's user avatar
  • 371
1 vote
0 answers
2k views

Angularjs: highlight a button on click

<tbody md-body> <tr md-row md-select="dessert" md-select-id="name" ng-model="participant.partName" md-auto-select ng-repeat="participant in participants track by participant....
Anuja Patil's user avatar
1 vote
2 answers
1k views

Angular Ng-If Appears To Lag

I am using an ng-if on an element to hide it until a certain condition is met. However, the condition gets met in my controller but the element appears to still not be in the DOM when my jquery ...
Summer Developer's user avatar
2 votes
3 answers
496 views

Add/Toggle CSS with AngularJS

So basically I have a control on my page which when clicked needs to toggle two different elements with two different CSS classes. I have managed to get it to toggle one of the controls, but not both....
Ben Clarke's user avatar
  • 1,061
0 votes
1 answer
963 views

Toggle Directive in AngularJS

I am trying to do something similar to this SO question. However, I need to do this in AngularJS. I need to animate the rotation of a button 180 degrees when someone clicks it. If the button is active,...
user687554's user avatar
  • 11.2k

15 30 50 per page