fuse-angular/src/app/app.component.ts

32 lines
637 B
TypeScript
Raw Normal View History

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