Advertisement
Guest User

Untitled

a guest
Mar 10th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, Input } from '@angular/core';
  2.  
  3. @Component({
  4.     moduleId: module.id,
  5.     selector: 'cc-context-menu',
  6.     template: `
  7.     <div class="{{menuclass}}" (mouseleave)='setVisibility($event, false)' (click)='setVisibility($event, true)' [ngClass]="{'show': showMenu}">
  8.         <ul>
  9.             <li *ngFor="let option of options">
  10.                 <a (click)="option.action()" [innerHTML]="option.html"></a>
  11.             </li>
  12.         </ul>
  13.     </div>
  14.  `
  15. })
  16. export class ContextMenuComponent {
  17.     showMenu: boolean = false;
  18.  
  19.     @Input() menuclass: string;
  20.     @Input() options: any[];
  21.  
  22.     setVisibility(e: Event, show: boolean) {
  23.         this.showMenu = show;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement