alfresco-ng2-components/docs/context-menu.directive.md
Cilibiu Bogdan c400d83b34 [ADF-1708] Context Menu - Material Design implementation (#2456)
* use angular material

* removed fdescribe
2017-10-11 10:14:52 +01:00

57 lines
1.1 KiB
Markdown

# Context Menu directive
<!-- markdown-toc start - Don't edit this section. npm run toc to generate it-->
<!-- toc -->
- [Basic Usage](#basic-usage)
- [Details](#details)
<!-- tocstop -->
<!-- markdown-toc end -->
## Basic Usage
```html
<my-component [context-menu]="menuItems"></my-component>
<context-menu-holder></context-menu-holder>
```
```ts
@Component({
selector: 'my-component'
})
export class MyComponent implements OnInit {
menuItems: any[];
constructor() {
this.menuItems = [
{ title: 'Item 1', subject: new Subject() },
{ title: 'Item 2', subject: new Subject() },
{ title: 'Item 3', subject: new Subject() }
];
}
ngOnInit() {
this.menuItems.forEach(l => l.subject.subscribe(item => this.commandCallback(item)));
}
commandCallback(item) {
alert(`Executing ${item.title} command.`);
}
}
```
### Properties
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| showIcons | boolean | false | Render defined icons |
## Details
See **Demo Shell** or **DocumentList** implementation for more details and use cases.