2017-07-12 12:35:07 +00:00
|
|
|
import { Component, ElementRef, OnInit, Renderer2 } from '@angular/core';
|
2017-06-27 08:08:19 +00:00
|
|
|
|
|
|
|
@Component({
|
2017-07-12 12:35:07 +00:00
|
|
|
selector : 'body',
|
2017-07-08 16:12:52 +00:00
|
|
|
templateUrl: './app.component.html',
|
2017-07-12 12:35:07 +00:00
|
|
|
styleUrls : ['./app.component.scss']
|
2017-06-27 08:08:19 +00:00
|
|
|
})
|
2017-07-08 16:12:52 +00:00
|
|
|
export class AppComponent implements OnInit
|
|
|
|
{
|
2017-07-12 12:35:07 +00:00
|
|
|
constructor(
|
|
|
|
private _renderer: Renderer2,
|
|
|
|
private _elementRef: ElementRef
|
|
|
|
)
|
|
|
|
{
|
|
|
|
}
|
2017-07-08 16:12:52 +00:00
|
|
|
|
2017-07-12 12:35:07 +00:00
|
|
|
addClass(className: string)
|
2017-07-08 16:12:52 +00:00
|
|
|
{
|
2017-07-12 12:35:07 +00:00
|
|
|
this._renderer.addClass(this._elementRef.nativeElement, className);
|
2017-07-08 16:12:52 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 12:35:07 +00:00
|
|
|
removeClass(className: string)
|
2017-07-08 16:12:52 +00:00
|
|
|
{
|
2017-07-12 12:35:07 +00:00
|
|
|
this._renderer.removeClass(this._elementRef.nativeElement, className);
|
2017-07-08 16:12:52 +00:00
|
|
|
}
|
|
|
|
|
2017-07-12 12:35:07 +00:00
|
|
|
ngOnInit()
|
2017-07-08 16:12:52 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2017-06-27 08:08:19 +00:00
|
|
|
}
|