alfresco-ng2-components/docs/core/context-menu.directive.md
Andy Stark 2a5fe7ad28 [ADF-2596] Fixed inputs with incorrect names (#3166)
* [ADF-2596] Updated prop script to handle names from input decorators

* [ADF-2596] Fixed inputs with accessors

* [ADF-2596] Fixed remaining inputs with wrong names

* [ADF-2596] Updated prop script to handle names from input decorators

* [ADF-2596] Fixed inputs with accessors

* [ADF-2596] Fixed remaining inputs with wrong names
2018-04-10 17:19:15 +01:00

1.1 KiB

Added, Status, Last reviewed
Added Status Last reviewed
v2.0.0 Active 2018-04-10

Context Menu directive

Adds a context menu to a component.

Basic Usage

<my-component [context-menu]="menuItems"></my-component>
<context-menu-holder></context-menu-holder>
@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
context-menu-enabled boolean false
context-menu any[]

Details

See Demo Shell or DocumentList implementation for more details and use cases.