Questions tagged [ng-class]

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

1
vote
2answers
35 views

Setting class dinamically from inside a directive not working properly with ng-animate

I'm loading a list of items from this public API. After it loads the list, I apply a transition to the elements using:/* ng-active */.ng-enter{opacity: 0.2;padding-left: 30px;...
0
votes
0answers
34 views

Perform a replace operation inside a ternary of an ng-class

Having an ng-class with a ternary like this:<i ng-class="$ctrl.toCheck > 0 ? 'fa fa-square' : 'fa fa-circle'"></i>ctrl.toCheck has the form of a string containing a number, like "43....
0
votes
1answer
54 views

Angular - ng-class or class [duplicate]

i would like to know, whats the real benefit of using ngClass/[ngClass] instead of class in Angular? Are there any performance differences?<div class="foobar">text</div>or<div ...
0
votes
1answer
37 views

How to add corresponding classes to the body element when each radio button is clicked in Angular 6

I want to add a specific class to the body tag and active class to the parent element when I click on each radio buttons.Eg: <form action="http://stackoverflow.com.mevn.net/"><input type="radio" value="layout1">...
0
votes
1answer
22 views

How to use ngClass to set the First class on an element?

I'm well aware of many ways to use ngClass to add classes to elements. But the classes added by ngClass always appear to be appended at the end of the element's classes. Is there a straightforward way ...
0
votes
1answer
32 views

How do I trigger the instance of my ng-class with my getter/setter?

I have a menu and when I click on a menu item a "is-active" class is applied via ng-class. The class applies a different color to the menu item to make it clear the menu item is selected. Each menu ...
0
votes
2answers
31 views

Binding same mouseover event to multiple [ngClass]

<li class="dropdown-submenu dropdown pointer" (mouseover)="toogleClickEvent($event)" (mouseout)="toogleClickEvent($event)"[ngClass]="show"><a class="test" tabindex="-1"><i class="...
1
vote
3answers
70 views

Difference between [ngClass]=“computeClass()” and class=“{{computeClass()}}” in Angular 4

What is the difference when computing class using ngClass and directly computing class using the HTML class attribute in Angular 4.[ngClass]="computeClass()"and class="{{computeClass()}}"...
0
votes
2answers
37 views

font awesome behavior with ng class

So my code is in angular version 5.I have a button with an icon. I am trying to make the icon dynamic. So i want to shift between send icon fa fa-paper-plane and loading iconfa fa-spinner fa-spin. ...
0
votes
1answer
20 views

Cannot create property 'selectedTest' on string 'test1' - problem with Angular

I want to have multiply active buttons (if selected), and when I click on selected button, I want to remove active class (toggle). How can I do this? If I do it like below, I have error: ERROR ...
0
votes
3answers
30 views

Angular - Activating a class when another class is activated by JS

I want to activate a class xyz when class xy is activated using ngClass.I want to implement this scenario:if class xyz is in the tagactivate class xyngClass="'xyz' then xy"
1
vote
2answers
89 views

Change navbar background-color on specific page in angular

I've been trying different ways of changing the background color of the navbar when I visit specific pages (i.e. contact page), in angular - I've looked at ngclasses and different ways of trying to ...
0
votes
1answer
34 views

ngClass toggle particular element only while using ngFor Angular5

I want to toggle particular element when clicked on click event and its in loop to toggle all class, means all div show. Here is my code<div *ngFor="let xyz of abc"><span (click)="...
0
votes
2answers
32 views

How to show component selector on click event Angular5

I am getting issue while display another component on click event, here is my code:<div (click)="showThis=true"></div><div class="" [ngClass]="{'hide': showThis}"></div>&...
1
vote
1answer
25 views

Add active class to selected elements angular (possibly multiple elements active)

I have group of buttons. When I click in one of this buttons, I want to have class active on this button. When I click next button, I also want to have class active on this button (and I dont't want ...

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,