Angular 2 Dart: How to add body class from inside component?
There are two way.
You can use
@HostBinding('class.someclass') bool isSomeClass = true;
in the root component if it has
selector: 'body'
or
document.querySelector('body').classes.add('someClass');
You can use :host-context(...)
to style a component depending on a selector matching a parent
:host-context(body.someClass) { background-color: red;}
will make the background color red when the body
element has class="someClass"
set.