I have three components. These are HomeComponent, SignInComponent and AppComponent. My Home Page (HomeComponent) is showing when the application opened. I clicked the \"Sign
Angular2 doesn't provide any built in way to modify DOM elements outside the root component (except the ).
querySelector('body').classList.add('signin-page');
querySelector('body').classList.remove('signin-page');
or
@Component(
selector: 'body',
templateUrl: 'app_element.html'
)
class AppElement {
@HostBinding('class.fixed')
bool isFixed = true;
}
See also