import { Component, AfterViewInit, Input, OnInit } from '@angular/core'; import {ApplicationService} from '../services/application.service'; declare var jQuery: any; @Component({ selector: 'site-menu', template: ` ` }) export class SiteMenuComponent implements AfterViewInit { @Input('type') type: string = 'fixed'; @Input('hidden') hidden: boolean = true; constructor(public application: ApplicationService) { } hiddenClass(): string { if (this.hidden) return "hidden"; else ""; } ngAfterViewInit(): void { setTimeout(() => this.attachSideBar(), 2000); } getMenuIconOrText(menuItem: any): string { if (menuItem.icon == null) return menuItem.name; else return ""; } makeActive(index: number): string { if (index == 0) return "active"; else return ""; } attachSideBar(): void { if (jQuery != null) { jQuery('.ui.sidebar') .sidebar('attach events', '.toc.item'); jQuery('.ui.dropdown') .dropdown(); } } }