Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

add class to element angular in ts

type one

[class.my-class]="step === 'step1'"
type two

[ngClass]="{'my-class': step === 'step1'}"
and multiple option:

[ngClass]="{'my-class': step === 'step1', 'my-class2':step === 'step2' }"
type three

[ngClass]="{1:'my-class1',2:'my-class2',3:'my-class4'}[step]"
type four

[ngClass]="(step=='step1')?'my-class1':'my-class2'"
Comment

angualr add class to component

@Component({
   selector: 'app-your-component',
   templateUrl: './your-component.component.html',,
   host: {'class': 'your-class'}
})
export class YourComponent implements OnInit {
...
}
Comment

add class based on value in angularjs

<tr ng-repeat="scores in Test" ng-class="{true: 'warning', false: 'ok'}[scores.Indicator == 'Negative']">                       
     <td>Overall: {{ scores.Indicator }}</td>
</tr>
Comment

PREVIOUS NEXT
Code Example
Typescript :: generic arrow function typescript 
Typescript :: distance using the constant velocity formula 
Typescript :: Make Object properties Readonly TypeScript 
Typescript :: best way to round to two typescript 
Typescript :: avoid intertwining subplots in python 
Typescript :: typescript type array of interface 
Typescript :: git check if its up to date 
Typescript :: moment datepicker 
Typescript :: where do you get your test data 
Typescript :: init tsconfig file 
Typescript :: typescript random 
Typescript :: add active class when element exists into an array vuejs 
Typescript :: jquery select multiple elements with same class 
Typescript :: how to check if key exists in Newtonsoft.Json object c# 
Typescript :: google sheets new line 
Typescript :: get all elements with id starts and class 
Typescript :: angular 12 model class 
Typescript :: python get list elements missing in one list 
Typescript :: await constructor typescript 
Typescript :: Create Type from String Enum 
Typescript :: computed vue typescript 
Typescript :: Lists - Learn C# 
Typescript :: avatar image mui not centered 
Typescript :: mongoose model enum 
Typescript :: typescript react theme-provider 
Typescript :: mat card api 
Typescript :: typescript get objects nested in object 
Typescript :: parse object typescript 
Typescript :: typescript array contains string 
Typescript :: python compare lists unordered 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =