All Questions
Tagged with angularjs-ng-class or ng-class
938 questions
2
votes
2
answers
97
views
ngClass has the wrong value while hydrating
The below [ngClass] expression doesn't insert the class name into DOM when Angular starts hydrating (only after it's finished).
<div class="document-pane" [ngClass]="{'single-view-...
1
vote
1
answer
742
views
Using Angular Signals with classes
I have found some behaviour that I can't understand. If I've got a bunch of styles applied like this:
.monkey-ion-item{
// Country Variant XXXX Not working after upgrade!
&.monkey-variant-...
1
vote
2
answers
73
views
Using ng-class to remove in Angular
I'm using ng-class to add a disabled class to a CTA in certain scenarios, but there is a split second delay before it gets applied, which means if the user is quick enough they can click the CTA. See ...
1
vote
1
answer
117
views
ng-class does not update on variable change using tailwindcss styles
I use Angular 18 and TailwindCSS. I wanted to create a cool typing animation with different colors per word. However, when currentColor updates to the next tailwind color, it does not show the proper ...
1
vote
1
answer
115
views
Angular directive css class selector is not working when class added by ngClass directive
Angular directive css class selector is not working when class added by ngClass directive.
This is my code example and I will also add playground at link
@Directive({
selector: '.test',
standalone:...
0
votes
1
answer
123
views
Changing validations of a select field dynamically in Angular
I am encountering an issue with my Angular application where I'm dynamically changing the required attribute of a select field in a form after it has been submitted.
evaluations.component.html
<...
0
votes
3
answers
896
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
3
answers
107
views
My NgClass is not being applied to the element
<mat-dialog-content class="mat-typography">
<div *ngFor="let form of addEmpForm; let i = index" class="example-container" [ngClass]="{
'example-...
1
vote
0
answers
100
views
Want to change background color of cell based on value of variable in mat table angular
I am using angular material and in that using mat-table.
Now I want to change background color of cell based on value of variable.
So if value is >50 then it should show yellow color OR show green ...
1
vote
1
answer
130
views
How do I shift my [ngClass] conditions into a separate ts file as a reusable code across all components, instead of repeating it in every html file?
Currently I have my codes working. However, my [ngClass] conditions are very bulky. Having it repeated in many components in the html makes it difficult to maintain if any change is needed and makes ...
0
votes
3
answers
995
views
How to change color of text in a table cell based on value in Angular?
I have the following table where the ESTADO field is a drop-down list that shows the possible statuses. I want the text of the td element of the ESTADO field to display a different color when entering ...
1
vote
1
answer
719
views
Angular 10 PrimeNG ngClass
I'm currently stuck with an issue on the Ternary operator, so I have this code:
[ngClass]="am.hasAssignmentRequiredData(bal) && am.isDirty(bal) ? '':'disable'"
so what this does is ...
1
vote
1
answer
495
views
use ngClass for styling matautocomplete
I'm trying to style a mat-autocomplete element with ngClass and I can't get it to work!
In my CSS I wrote:
::ng-deep .default .mat-autocomplete-panel {
background-color: white !important;
border:...
0
votes
0
answers
62
views
Angular9 Exception: Can't bind to 'ngClass' since it isn't a known property of 'input' [duplicate]
Can't bind to 'ngClass' since it isn't a known property of 'input'.
I have migrated the angular project from version 8 to 9 and facing this type of errors.
src/app/components/header/header.component....
0
votes
1
answer
2k
views
Unable to use ngClass with ng-container to build table, Angular
I have a generic table component and I want to make the row hoverable by binding class using ngClass to a ng-container. However I an error.
The code:
<ng-container *ngFor="let row of manager....