File

src/client/app/components/home/home.component.ts

Implements

OnInit AfterViewInit

Metadata

moduleId module.id
selector sd-home
styleUrls home.component.css
templateUrl home.component.html

Index

Properties
Methods

Constructor

constructor(_appService: AppService, routerExt: RouterExtensions)

Methods

Private _calcHeight
_calcHeight()
Returns : void
ngAfterViewInit
ngAfterViewInit()
Returns : void
ngOnInit
ngOnInit()
Returns : void
onWindowResize
onWindowResize(event: any)
Returns : void

Properties

el
el: ElementRef
Type : ElementRef
Decorators : ViewChild
height
height: number
Type : number
Public routerExt
routerExt: RouterExtensions
Type : RouterExtensions
timeOut
timeOut: any
Type : any
import {Component, ElementRef, ViewChild, OnInit, AfterViewInit} from '@angular/core';


import {AppService, RouterExtensions} from '../../modules/core/services/index';

@Component({
  moduleId: module.id,
  selector: 'sd-home',
  templateUrl: 'home.component.html',
  styleUrls: ['home.component.css']
})
export class HomeComponent implements OnInit, AfterViewInit {

  @ViewChild('el') el: ElementRef;
  height: number;
  timeOut: any;

  constructor(private _appService: AppService,
              public routerExt: RouterExtensions) {
  }

  ngOnInit() {
    if (typeof document === 'object' && document.title) {
      document.title = 'home';
      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);

    }
  }

}
<div class="container-fluid" #el [ngStyle]="{'height': height + 'px'}" (resize)="onWindowResize($event)">
    <ul class="nav nav-pills nav-stacked">
        <li>
            <a [routerLink]="['/puzzle']" class="btn btn-default btn-lg btn-block">{{'PLAY' | translate}}</a>
        </li>
        <li>
            <a [routerLink]="['/about']" class="btn btn-default btn-lg btn-block">{{'ABOUT' | translate}}</a>
        </li>
        <li>
            <a href="#" class="btn btn-default btn-lg btn-block">{{'GOOGLE_PLAY' | translate}}</a>
        </li>
        <li>
            <a href="#" class="btn btn-default btn-lg btn-block">{{'APP_STORE' | translate}}</a>
        </li>
    </ul>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""