alfresco-ng2-components/docs/core/context-menu.directive.md
Eugenio Romano 7d061b2c11
[ADF-1873] Remove all deprecated code from ADF (#4145)
* remove deprecated code part 1

* remove deprecation step 2

* fix spellcheck

* fix

* fix lint

* fix not used import

* remove deprecation

* fix test first part after remove deprecation

* fix test

* fix sidebar demo shell
2019-01-15 15:36:01 +00:00

1.3 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Context Menu directive v2.0.0 Active 2018-11-20

Context Menu directive

Adds a context menu to a component.

Basic Usage

<my-component [context-menu]="menuItems"></my-component>
<adf-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
enabled boolean false Is the menu enabled?
links any[] Items for the menu.

Details

See the Demo Shell or Document List component implementation for more details and use cases.