1.0.0 • Published 2 years ago
ngx-body-class v1.0.0
ngx-body-class
An angular directive for adding classes to the body
element
Basic Usage
In your module:
import { NgxBodyClassModule } from 'ngx-body-class';
@NgModule({
...
imports: [ NgxBodyClassModule ],
...
})
export class MyModule {}
In the component's template:
<div ngxBodyClass="my-class">
Causes my-class to be added as a class to the body element
</div>
<div [ngxBodyClass]="['red', isNumberEven ? 'even' : 'odd']">
...
</div>
Notes
- This library can be of use particularly when trying to style modals that are added as children of the body element.
- Any classes added by the directive are removed when the directive is destroyed
License
MIT