60 questions
0
votes
3
answers
830
views
ngClass does not switch value when using object in component
When I use the following code to switch the class everything works fine
<p [ngClass]="idPresent ? 'alert alert-success' : 'alert alert-danger'">
Working
</p>
On changing the ...
0
votes
0
answers
26
views
bug situation with Angular_Ng0303 *ngFor
I,ve been some days I started learning Angular, and now I'm having some troubles (here's the problem) when calling to the *ngForOf directive in a li, can someone help me?
pd: In the trouble picture, ...
1
vote
3
answers
80
views
How to add condition and function both in ngClass?
I need to use both function and condition in ngClass like below:
<div [ngClass] = "i==1 ? 'active':'inactive',getclass()">
</div
TS
getclass(){
return 'myclassname'
}
1
vote
1
answer
486
views
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 ...
0
votes
0
answers
757
views
Facing issue in adding style to ng-container for only inside a div
I am trying to mimic the behavior of mat-form-field for required validation on ng-select
In order to mimic the behaviour I need to add border and color as red when mat-error trigeered.
Here is my HTML
...
0
votes
2
answers
2k
views
How can I apply pseudo class by condition in Angular?
I have the following css
#auction-history div:after {
content: "";
width: 100%;
height: 8px;
position: absolute;
bottom: -8px;
background: #bad3e0;
left: 0;
}
...
-1
votes
2
answers
647
views
How can we write two ngClass in one div? [duplicate]
Can we add two ng-class in one div?
If so then how to write it.
How can we write this together?
Thank you in advance.
<div [ngClass]={'white-background': policy number.length <=0}
[ngClass]=&...
1
vote
2
answers
3k
views
Angular6 Can't use ternary operator in ngClass with multiple entries
I'm trying to add multiple classes by ngClass, and I'm confused as to why I can't use ternary operator here.
<div [ngClass]="{'otherClass': otherFlag, classFlag ? 'class--true': 'class--false'}...
0
votes
1
answer
86
views
angular - how to combine few ngclass together in one div
I would like to combine multiple ngClass if else statement together, I have tried but not able to resolve it.
<div
[ngClass]="[tabItem === 'unavailable' ? 'background-grey' : selected ? '...
0
votes
4
answers
1k
views
How to use a function and expression in a ngClass using Angular?
I'm currently trying to show a list of Pokemons that have a different background color depending on their type. I would like to implement a feature where the border of the selected pokemon also shows ...
0
votes
1
answer
794
views
Angular 11 - text-decoration: line-through does not work properly with class binding
So I am making a todo app and I want to add stroke to the done tasks but the problem is that it is not working properly.
my .css file
.stroke{
text-decoration: line-through
}
and the element in ...
2
votes
2
answers
478
views
Efficiently apply [ngClass] expression against td
I am loading a dynamic table from a JSON file and on td i am using an angular expression to evaluate the css class name based on some application logics
The HTML and TS code is like below
<td *...
1
vote
2
answers
709
views
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....
-1
votes
2
answers
829
views
Angular : how to toggle selection between children components
So I have got a parent component with children components binded over an ngFor()such as:
<categories *ngFor= "let category of categories" [category]="category"></...
0
votes
0
answers
893
views
Angular Material Table Apply Class based on [dataSource]
I have built an Angular Material Table and would like to use class error-text if the [dataSource] returns isActive=false.
I'm trying to do this with no luck:
<table
mat-table
[dataSource]="...