ng-semantic
Version:
Angular2 building blocks based on Semantic UI
44 lines (39 loc) • 1.23 kB
text/typescript
import { Component, Input, ChangeDetectionStrategy, HostListener } from "@angular/core";
/**
* Implementation of Dropdown module on right click
*
* @link http://semantic-ui.com/modules/dropdown.html
*/
export class SemanticContextMenuComponent {
_position: { x: number, y: number } = { x: 0, y: 0 };
show: boolean = false;
items: Array<{}>;
set position(data: { x: number, y: number }) {
if (data) {
this._position = data;
this.show = true;
}
}
public clickedOutside(): void {
this.show = false;
}
}