angualr add class to component
@Component({
selector: 'app-your-component',
templateUrl: './your-component.component.html',,
host: {'class': 'your-class'}
})
export class YourComponent implements OnInit {
...
}
angualr add class to component
@Component({
selector: 'app-your-component',
templateUrl: './your-component.component.html',,
host: {'class': 'your-class'}
})
export class YourComponent implements OnInit {
...
}
ng class multiple class names
<!-- notice expression1 used twice -->
<div ng-class="{class1 : expression1, class2 : expression1}">
Hello World!
</div>
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'"
angular bind to class or ngClass
<div [ngClass]="{'extra-sparkle': isDelightful}">
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us