Welcome to the Alfresco Builder Network

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'
})
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

NameTypeDefault valueDescription
enabledbooleanfalseIs the menu enabled?
linksany[]Items for the menu.

Details

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

Interested in trying Alfresco?

Try Now