import { Component, AfterViewInit, OnInit } from '@angular/core'; @Component({ selector: 'app-sidebar', templateUrl: './sidebar.component.html' }) export class SidebarComponent implements AfterViewInit { // this is for the open close isActive = true; showMenu = 'New Order'; showSubMenu = ''; addExpandClass(element: any) { if (element === this.showMenu) { this.showMenu = '0'; } else { this.showMenu = element; } } addActiveClass(element: any) { if (element === this.showSubMenu) { this.showSubMenu = '0'; } else { this.showSubMenu = element; } } eventCalled() { this.isActive = !this.isActive; } // End open close ngAfterViewInit() { $(function() { $('.sidebartoggler').on('click', function() { if ($('body').hasClass('mini-sidebar')) { $('body').trigger('resize'); $('.scroll-sidebar, .slimScrollDiv') .css('overflow', 'hidden') .parent() .css('overflow', 'visible'); $('body').removeClass('mini-sidebar'); // $('.navbar-brand span').show(); $('.navbar-brand .logo-long').show(); $('.navbar-brand .logo-short').hide(); // $(".sidebartoggler i").addClass("ti-menu"); } else { $('body').trigger('resize'); $('.scroll-sidebar, .slimScrollDiv') .css('overflow-x', 'visible') .parent() .css('overflow', 'visible'); $('body').addClass('mini-sidebar'); // $('.navbar-brand span').hide(); $('.navbar-brand .logo-long').hide(); $('.navbar-brand .logo-short').show(); // $(".sidebartoggler i").removeClass("ti-menu"); } }); }); } }