Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
1k views

I have an application developed in Angular with Material components. I'm using Material Theme to have a few different themes to my app (Dark, Light, Colorful). My main component - app.component html ...
Gil Epshtain's user avatar
  • 9,991
0 votes
1 answer
2k views

within my angular application, I'm going through the following array of objects to display my elements on the screen [{ "name": "Equipment", "functional_id": "furniture", "products": [ { ...
homerThinking's user avatar
2 votes
1 answer
1k views

I have a span element in ngx datatable. I want to change the css class dynamically based on the value. Here's my html code: <ngx-datatable #orderinvoice class="bootstrap" [rows]="invoiceSource" [...
user2564537's user avatar
  • 1,061
-3 votes
1 answer
1k views

is it possible to add 2 objects to an ngclass function like <div class="progress-bar"[ngClass]="getProgressValues(obj.val1,obj.val2)"> </div> i get a Json error. SyntaxError: JSON....
Pearl's user avatar
  • 39
1 vote
2 answers
1k views

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 ...
juanjinario's user avatar
0 votes
4 answers
9k views

I'm looping over an array that contains a varying amount of percentages. However, I would like to add classes based on if an answer from the database equals one of the values from the array. The ...
Haven's user avatar
  • 87
0 votes
2 answers
2k views

Hi i have a problem with a simple angular component, i'm using a reactive form to insert text then i loop the text by using ngFor after i want to set active one element by click but when i click one ...
michelemalagnini's user avatar
1 vote
1 answer
657 views

Angular v8. I have a tag that uses the [ngClass] directive. The expression calls a function. How do I get ngClass to re-evaluate said expression after conditions have changed? It only seems to be ...
lightbulb112's user avatar
0 votes
1 answer
95 views

I have the following code: <span data-toggle="collapse" data-target="#some-id"> <span class="glyphicon" ng-class="ctrl.test() ? 'glyphicon-minus-sign': '...
Dave_dev's user avatar
1 vote
2 answers
2k views

I do not want the user to select a future date, but if he/she does, I want to display a red border around the p-calendar's input field. My css code: .invalid-date ::ng-deep>p-calendar>.ui-...
Kirsten de Wit's user avatar
0 votes
1 answer
43 views

I use a function in NgClass that uses an array filled in ngOnInit. ngOnInit -> prepareRezerwation() create colorRezerwation veriable: this.nodeService.getRezerwations(this.minMax).subscribe(...
VolRecon's user avatar
0 votes
1 answer
651 views

Context In an Angular project, I have made a component to encapsulate the logic of a submit request page (code below). This page has two subcomponents that define specific forms (firstForm and ...
adrisons's user avatar
  • 3,733
1 vote
3 answers
304 views

I have the following data structure: this.filters = [ { key: 'filter1', active: true, class: 'filter1Class' }, { key: 'filter2', active: false, class: 'filter2Class' ...
cucuru's user avatar
  • 3,758
-1 votes
1 answer
229 views

I am trying to set an active class based on the value in ng-repeat. I am able to achieve it on the first-page load based on the default but whenever the value is changed the class is not changed. I am ...
Tajkumar's user avatar
  • 541
1 vote
2 answers
499 views

I hav a directive that looks roughly like this, with an ng-class in the template: module.directive('myDirective', [function() { return { restrict: 'E', template: `<div ng-class=...
elethan's user avatar
  • 17.1k
-1 votes
1 answer
659 views

I am using [ngClass] to choose css class based on material table row value. On mouse over event I am changing flag value which fetching cssclass and which is working fine. But when I am debugging it I ...
Jignesh Patel's user avatar
0 votes
1 answer
454 views

I am trying to use ngclass for my condition to apply css for the below html code but it was showing error. I want to use two class that is colorRed & colorOrange Here is my Two class (CSS) ...
Mr.M's user avatar
  • 1,503
0 votes
1 answer
39 views

Angular Code Green color not appearing app.component.css .text-success{color:green} app.component.html <h2 [ngClass]='borde'>Hello World</h2> app.component.ts showColor:true public ...
KUNAL TIWARI's user avatar
0 votes
1 answer
249 views

I've been programming in Angular for a short time and I got stuck on the button design. I have already implemented them with an ngIf, appearing and disappearing dynamically depending on whether they ...
homerThinking's user avatar
0 votes
1 answer
302 views

I made this code to change the css of the nav-bar options when the active page changes. html: <ul> <li routerLink="/" id="homePage" (click)="selected($event)" [...
Alex Skotner's user avatar
0 votes
3 answers
1k views

I am new in angular I am trying to change the state of my button in the navbar, taking into consideration the navigation route, however when clicking my button I select all the other buttons including ...
Erick91's user avatar
  • 57
4 votes
2 answers
3k views

I have a div which needs to be blurred/reduced opacity on mouseenter. I've created 2 css class called .blur and .less-opacity Component.css .blur { -webkit-filter: blur(10px); -moz-filter: ...
Sixteen's user avatar
  • 553
0 votes
1 answer
3k views

Might be a beginners question but I'm really stuck here. Just trying to toggle the class of an element I added to my HTML like this: <ion-card [ngClass]="{ 'inactive': step2Inactive, 'button-...
MincedMeatMole's user avatar
0 votes
1 answer
428 views

I'm using Angular 8 and bootstrap 4 to build a navbar which changes its color from transparent to dark when a certain amount to scroll happens. I'm using [ngClass] directive in order to achieve it. ...
chatterjeetridib's user avatar
-1 votes
1 answer
5k views

I have 2 different pages which is going to display the same data and both are sharing the same components. But both pages has different resolution one is the size with the alert box and one is ...
user avatar
0 votes
3 answers
915 views

This is angular app, I want to apply css class based on condition that char length of variable is greater than 128 char. I was inspired by this post enter link description here. As shown below in the ...
karansys's user avatar
  • 2,769
-1 votes
1 answer
92 views

This is a dummy coding that describes my problem HTML <div ng-class="{'test': isAllowed }" id='example1'>Example 1</div> <div ng-class="{'test': isAllowed }" id='example2'>Example 2&...
Ngoc Phuong Le's user avatar
0 votes
1 answer
226 views

I am using below syntax but I am not able to implement it. I want to change margin-left dynamically, depending on the div class. ng-style="{ 'margin-left: 120px' :col-xs-12 || 'margin-left: 400px' :...
Shashwat Tyagi's user avatar
0 votes
1 answer
1k views

I am developing a Breadcrumb component in Angular which will show the complete address about the routing. Helping the user to go back to any step it was before. To get the actual url I am using ...
JoseJimRin's user avatar
2 votes
1 answer
3k views

I can use multiple conditions like that: <div [ngClass]="{'checked': isChecked, 'disabled': isDisabled}"> And conditional (ternary) operator like that: <div [ngClass]="isEmpty ? 'empty-...
vagavan's user avatar
  • 625
1 vote
0 answers
246 views

I have a div structure like follows, <ul data-ng-class="{'dropDownDisabled': (items.results && items.results.disabled) }"> <li class="dropdown-item org-labels"> {{...
learner's user avatar
  • 407
0 votes
5 answers
854 views

Using Angular 7, I have created an ngClass method in my component .ts file and works great. What I want is to use that same method in all my components without re-writing the code, but I'm not sure ...
Rick's user avatar
  • 1,882
2 votes
2 answers
100 views

Imagine following situation: <div *ngFor="let d of dm; first as first"> <span [ngClass]="{ cSmall: !first, cGray: !first, cTab1: !first }" > {{ d }} </span> ...
user avatar
0 votes
1 answer
937 views

This is an annoying issue if I can say so ... If I use a method in the template, this will be called so many timesss.... due of the change detection of Angular. 3511 messages (method calls) in just ...
AlleXyS's user avatar
  • 2,598
0 votes
1 answer
1k views

I'm adding and removing class using ngClass. I want to change pointer. My html code of the component [ngClass]="{'zoom-cursor': cyClass}" I have a boolean called cyClass in the corresponding ...
canbax's user avatar
  • 3,918
1 vote
2 answers
266 views

I am using reactive form using FormBuilder in Angular 8 Application , where i am using ngClass for multiple option I am sharing some part of my code <input [ngClass]="{(name.valid)?'...
Anurag Ranjan's user avatar
3 votes
1 answer
11k views

I added a custom ngclass to my mat-table to to make the rows clickable. but now I would like the user to be able to navigate using the up and down arrow keys. using this git hub as a reference(https://...
Flash's user avatar
  • 1,014
0 votes
2 answers
3k views

I use this part of code to change the background color of a cell when register.day is equals to 'NO REG.': <td class="text-center" [ngClass]="{'red': register.day1 == 'NO REG.'}"> {{register....
Enrique Portillo's user avatar
1 vote
2 answers
4k views

I'm stuck and I need some help. I have a table with column name deadLine. The data came from MySQL and is DATETIME properties. I've created a function that checks if the date in the column has ...
Baruch_Mashasha's user avatar
0 votes
1 answer
1k views

I'm trying to change the background color of my mat-select option or the div container using ngClass in Angular 8 whenever I changed the value, followed the documentation and some samples but they ...
Carlo A's user avatar
  • 127
0 votes
1 answer
322 views

I am using angular-7, I want to change the colour of tab depending on the validation, i have added customClass where i am checking if timesheet is valid or not, if it is invalid i want to change the ...
Vikas Kalapur's user avatar
0 votes
2 answers
349 views

I have a simple ng-class that switches two classes based on the condition. When the class is switched, the order of the classes is messed up not sure why. Has anyone a solution for this? <div ...
wibwaj's user avatar
  • 113
1 vote
3 answers
14k views

How can I check with Angular if a DOM element has a class and then add a class to another element? My Template: <div class="d-table"> <ui-switch class="d-table-cell"> <span ...
Codehan25's user avatar
  • 3,042
1 vote
1 answer
2k views

I'm trying to apply multiple classes through ngClass. No conditions. I have 2 variables that is a string of the class name. Passing in one variable is easy enough [ngClass]='variable1?.font' I tried ...
PrettyBiased's user avatar
0 votes
1 answer
220 views

I've done a request to Itunes Api to show the results of the database. The request is with and input, where I can write a word and the Api returns me all the music/tracks/artists/albums which match ...
Pol Plana Ayet's user avatar
2 votes
3 answers
1k views

I have a css code that looks like this: :host >>> a.ng2-smart-sort-link.sort::after { content: ''; right: 0.75rem; position: absolute; display: inline-block; ...
mihaij's user avatar
  • 95
31 votes
5 answers
104k views

I want to use multiple classes inside Angular [ngClass]. I have two classes, It should work accordingly as per the condition of the flag, that are already passed from the component.ts.
Akshay Kumar's user avatar
2 votes
2 answers
1k views

I need to set green dot class if the person is available and set red dot if the person is busy. "available" or "busy" is a string which will be the response from API. I tried to set the class using ng-...
Mishty's user avatar
  • 123
0 votes
1 answer
40 views

I have a html format like this , when sec.newValue is not empty I want it to be displayed bold and if its empty , I want to display as it is. so how can I achieve this using ng-class,i tried giving ...
Nicoleta Wilskon's user avatar
-1 votes
3 answers
515 views

When ngClass is used in Object - keys manner it does not evaluate right. For example if I have in html: <div [ngClass]="{'cbold': bold, 'citalic': italic, 'cunderline': underline}">Some ...
ingbabic's user avatar
  • 351

1 2
3
4 5
19