src/client/app/components/about/about.component.ts
moduleId | module.id |
selector | sd-about |
styleUrls | about.component.css |
templateUrl | about.component.html |
Properties |
Methods |
constructor(_appService: AppService, injector: Injector)
|
Private _calcHeight |
_calcHeight()
|
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
onWindowResize |
onWindowResize(event: any)
|
Returns :
void
|
Private _page |
_page:
|
Type : any
|
el |
el:
|
Type : ElementRef
|
Decorators : ViewChild
|
height |
height:
|
Type : number
|
Private page |
page:
|
timeOut |
timeOut:
|
Type : any
|
import {Injector, Component, OnInit, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
import {AppService} from '../../modules/core/services/index';
import {Config} from '../../modules/core/index';
@Component({
moduleId: module.id,
selector: 'sd-about',
templateUrl: 'about.component.html',
styleUrls: [
'about.component.css',
],
})
export class AboutComponent implements OnInit, AfterViewInit {
@ViewChild('el') el: ElementRef;
height: number;
timeOut: any;
private _page: any;
private get page() {
if (Config.PageClass) {
if (!this._page) {
this._page = this.injector.get(Config.PageClass);
}
return this._page;
}
}
constructor(private _appService: AppService,
private injector: Injector) {
}
ngOnInit() {
if (typeof document === 'object' && document.title) {
document.title = 'About';
this._calcHeight();
}
}
ngAfterViewInit(): void {
this._appService.isPreloader = false;
}
onWindowResize(event: any) {
if (this.timeOut) {
window.clearTimeout(this.timeOut);
}
this.timeOut = window.setTimeout(() => {
this._calcHeight();
}, 64);
}
private _calcHeight() {
if (typeof document === 'object' && document.title) {
this.height = this.el.nativeElement.offsetParent.offsetHeight - (48 * 2) - 16;
}
}
}
<div #el [ngStyle]="{'height': height + 'px'}" (resize)="onWindowResize($event)">
<p>{{'ABOUT_CONTENT_1' | translate}}<a href='http://www.enipuzzles.com/' target='_blank'>Eni Puzzle</a>{{'ABOUT_CONTENT_2' | translate}}
</div>