Angular - Built-In Directives
Angular - Built-In Directives
COMMON
DETAILS
DIRECTIVES
access.
NgClass .
Import in the component
To use NgClass , import CommonModule and add it to the component's
imports list.
{ } '@angular∕common';
∕* . . . *∕
@Component({
standalone: ,
∕* . . . *∕
imports: [
, ∕∕ <-- import into the component
∕* . . . *∕
],
})
{
∕* . . . *∕
}
src/app/app.component.html
the class.
src/app/app.component.ts
src/app/app.component.html
For this use case, Angular applies the classes on initialization and in
imports list.
{ } '@angular∕common';
∕* . . . *∕
@Component({
standalone: ,
∕* . . . *∕
imports: [
, ∕∕ <-- import into the component
∕* . . . *∕
],
})
{
∕* . . . *∕
}
src/app/app.component.ts
currentStyles