mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-4152] Updated folder structure of core docs (#4415)
* [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Moved core library docs into subfolders * [ADF-4152] Manual fixes to core doc file links * [ADF-4152] Further automatic + manual link tidying
This commit is contained in:
committed by
Eugenio Romano
parent
285e56e9fb
commit
5fc05da7aa
58
docs/core/directives/context-menu.directive.md
Normal file
58
docs/core/directives/context-menu.directive.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
Title: Context Menu directive
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-11-20
|
||||
---
|
||||
|
||||
# [Context Menu directive](../../../lib/core/context-menu/context-menu.directive.ts "Defined in context-menu.directive.ts")
|
||||
|
||||
Adds a context menu to a component.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
```html
|
||||
<my-component [adf-context-menu]="menuItems"></my-component>
|
||||
<adf-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.`);
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Class members
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| enabled | `boolean` | false | Is the menu enabled? |
|
||||
| links | `any[]` | | Items for the menu. |
|
||||
|
||||
## Details
|
||||
|
||||
See the [Demo Shell](../../../demo-shell/README.md)
|
||||
or [Document List component](../../content-services/document-list.component.md) implementation for more details and use cases.
|
Reference in New Issue
Block a user