I have diffirent classes for login page and other pages in application so after user logged in I need to change class of body element. Here how I am trying to accomplish thi
One way is to use make the tag the app element by using
body
as selector and use host-binding to update the app elements classes.
@Component({
selector: 'body',
host: {'[class.someClass]':'someField'}
})
export class AppComponent implements AfterViewInit {
someField: bool = false;
// alternatively to the host parameter in `@Component`
// @HostBinding('class.someClass') someField: bool = false;
ngAfterViewInit() {
someField = true; // set class `someClass` on ``
}
}