Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
- import { SidebarService } from '../sidebar.service';
- @Component({
- selector: 'app-sidebar',
- template: `
- <div [ngStyle]="!showSidebar && {display: 'none'}">
- <ng-container #container></ng-container>
- </div>
- `
- })
- export class SidebarComponent implements OnInit {
- @ViewChild('container', { read: ViewContainerRef }) container;
- constructor( private _sidebarService : SidebarService ) {
- }
- ngOnInit() {
- this._sidebarService.vcr = this.container;
- }
- get showSidebar() {
- return this.container && this.container.length;
- }
- }
Add Comment
Please, Sign In to add comment