Guest User

Untitled

a guest
Oct 22nd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import { Component, OnInit, ViewChild, ViewContainerRef } from '@angular/core';
  2. import { SidebarService } from '../sidebar.service';
  3.  
  4. @Component({
  5. selector: 'app-sidebar',
  6. template: `
  7. <div [ngStyle]="!showSidebar && {display: 'none'}">
  8. <ng-container #container></ng-container>
  9. </div>
  10. `
  11. })
  12. export class SidebarComponent implements OnInit {
  13. @ViewChild('container', { read: ViewContainerRef }) container;
  14.  
  15. constructor( private _sidebarService : SidebarService ) {
  16. }
  17.  
  18. ngOnInit() {
  19. this._sidebarService.vcr = this.container;
  20. }
  21.  
  22. get showSidebar() {
  23. return this.container && this.container.length;
  24. }
  25.  
  26. }
Add Comment
Please, Sign In to add comment