(Showing Draft Content)

WjContextMenu Class

WjContextMenu Class

Angular 2 directive for context menus.

Use the wjContextMenu directive to add context menus to elements on the page. The wjContextMenu directive is based on the wj-menu component; it displays a popup menu when the user performs a context menu request on an element (usually a right-click).

The wjContextMenu directive is specified as a parameter added to the element that the context menu applies to. The parameter value is a reference to the wj-menu component. For example:

<!-- paragraph with a context menu -->
<p [wjContextMenu]="menu" >
 This paragraph has a context menu.</p>

<!-- define the context menu (hidden and with an id) -->
<wj-menu #menu style="display:none">
 <wj-menu-item [cmd]="cmdOpen" [cmdParam] ="1">Open...</wj-menu-item>
 <wj-menu-item [cmd]="cmdSave" [cmdParam]="2">Save </wj-menu-item>
 <wj-menu-item [cmd]="cmdSave" [cmdParam]="3">Save As...</wj-menu-item>
 <wj-menu-item [cmd]="cmdNew" [cmdParam] ="4">New...</wj-menu-item>
 <wj-menu-item [cmd]="cmdExit" [cmdParam]="5">Exit</wj-menu-item>
</wj-menu >


  • WjContextMenu