Questions tagged [angular-ng-class]
60 questions
1
vote
3 answers
How to add condition and function both in ngClass?
I need to use both function and condition in ngClass like below:

sridharkctmca
- 15
- 4
1
vote
1 answer
ngClass not detecting the changes when current item related to array change
iam listing some images from an array,the current image has a orage border.
when the user clicks an image it becomes the current image
but on clicking the border from previous current image disappearing but class containing orage border is not…

sinan
- 133
- 8
1
vote
2 answers
routerLinkActive id coupled with [ngClass]
Below web-link demonstrates the routerLinkActive id working when used as a boolean value for a distinct HTML element' [ngClass]
https://stackblitz.com/edit/routerlinkactivesimple?file=src%2Fapp%2Fapp.module.ts
In contrast the routerLinkActive id is…

Caesarius
- 115
- 5
1
vote
2 answers
Which way has the best performance applying several classes to html tags? Angular 2
I am building a calendar with prices, I have 3 nested elements:
- calendar-layout
-- calendar-month
--- calendar-week
In the calendar-week I have to do several calculations for the different styles that can have each day,
// Calendar-week…

juanjinario
- 596
- 1
- 9
- 24
1
vote
5 answers
ngClass directive to use with ngFor
I have some list elements, which I am rendering using *ngFor directive. However, some part of the list items text should be bold according to the specs. I tried to do this with the [ngClass]="'strong'" when strong is the css class I need to add some…
user12050907
1
vote
2 answers
Button color change based on condition in ngclass in Angular6
If i click the button it will change the color in to orange but by requirement is after click the same button it need to change into default color. so please guid me to do this.
1
vote
3 answers
ngClass wrong answer
After going through a lot of questions , I have decided to ask this...
The angular [ngClass] is working weird on the values for 10 , 24 , 100 . I don't know the reason behind it . Hoping you could all may help...

Mayank Agarwal
- 33
- 1
- 5
1
vote
0 answers
Delaying display of page until [ngClass] has been evaluated
Background I have a header component having [ngClass] attached to top div.
Question Is it possible to delay displaying of page until [ngClass] has been evaluated? We used to have ng-cloak in AngularJs. Do we have something similar in Angular?
Why I…

shobhit vaish
- 951
- 8
- 22
1
vote
0 answers
ngClass style not being applied
I have a component with a TS file that has this section in it:
@Component({
selector: 'nav-menu',
templateUrl: './navmenu.component.html',
styleUrls: ['./navmenu.component.scss']
})
I then have a div in my HTML file that uses ngClass…

Starfleet Security
- 1,813
- 3
- 25
- 31
1
vote
8 answers
Add and Remove class in Angular
I want to add background color to the li element when clicked but when I clicked another li element the previous li element background color remains unchanged.
component.html
News By Type
-
Bhaskararao Gummidi
- 1,605
- 3
- 12
- 14
1
vote
2 answers
How to remove ngClass while widening the screen
I am adding a class to 2 div to toggle sidebar header using [ngClass] how do i remove those class when enlarge the screen.
The problem is on widening the screen it remains there only because class is not removed. How do i remove the class?
On…

Samson Maben
- 310
- 2
- 4
- 15
1
vote
3 answers
how to apply border color for ion-card using ngClass
i an array like below
this.defaultBackground=[{"applyBackground":"true"},{"applyBackground":"false"}];
in my html i have used ion-card

Mohan Gopi
- 7,606
- 17
- 66
- 117
1
vote
0 answers
ng-class binding in kendo menu
i'm trying to bind a CSS class to a button of a kendo menu :
Here is my code for the menu :
{
id: "button_grille_tri",
type: "splitButton",
menuButtons :…

quentin marinie
- 11
- 4
1
vote
0 answers
Issue with ng-class when wrapping an element as an angular directive
I'm wrapping a 3rd party directive as an angular directive. Let's call it . I must.
In the template, I have a conditional class on the , which looks something like this:

ppseprus
- 538
- 1
- 8
- 26
1
vote
1 answer