Techno Blender
Digitally Yours.

Angular PrimeNG ContextMenu Events – GeeksforGeeks

0 41


import { Component, ViewChild } from "@angular/core";

import { MenuItem, MessageService } from "primeng/api";

  

@Component({

    selector: "app-root",

    templateUrl: "./app.component.html",

    providers: [MessageService]

})

  

export class AppComponent {

    items: MenuItem[];

    constructor(private messageService: MessageService) {}

  

    ngOnInit() {

        this.items = [

            {

                label: "Visit Website",

                icon: "pi pi-fw pi-globe"

            },

            {

                label: "Like",

                icon: "pi pi-fw pi-thumbs-up-fill"

            },

            {

                label: "More",

                icon: "pi pi-fw pi-folder",

                items: [

                    {

                        label: "New",

                        icon: "pi pi-fw pi-plus"

                    },

                    {

                        label: "Share",

                        icon: "pi pi-fw pi-share-alt"

                    },

                    {

                        label: "Search",

                        icon: "pi pi-fw pi-search"

                    }

                ]

            },

  

            {

                separator: true

            },

            {

                label: "Quit",

                icon: "pi pi-fw pi-power-off"

            }

        ];

    }

  

    handleShow(event) {

        this.messageService.add({

            severity: "success",

            summary: "ContextMenu onShow",

            detail: "Welcome to GeeksforGeeks"

        });

    }

    handleHide(event) {

        this.messageService.add({

            severity: "error",

            summary: "ContextMenu onHide",

            detail: "Welcome to GeeksforGeeks"

        });

    }

}


import { Component, ViewChild } from "@angular/core";

import { MenuItem, MessageService } from "primeng/api";

  

@Component({

    selector: "app-root",

    templateUrl: "./app.component.html",

    providers: [MessageService]

})

  

export class AppComponent {

    items: MenuItem[];

    constructor(private messageService: MessageService) {}

  

    ngOnInit() {

        this.items = [

            {

                label: "Visit Website",

                icon: "pi pi-fw pi-globe"

            },

            {

                label: "Like",

                icon: "pi pi-fw pi-thumbs-up-fill"

            },

            {

                label: "More",

                icon: "pi pi-fw pi-folder",

                items: [

                    {

                        label: "New",

                        icon: "pi pi-fw pi-plus"

                    },

                    {

                        label: "Share",

                        icon: "pi pi-fw pi-share-alt"

                    },

                    {

                        label: "Search",

                        icon: "pi pi-fw pi-search"

                    }

                ]

            },

  

            {

                separator: true

            },

            {

                label: "Quit",

                icon: "pi pi-fw pi-power-off"

            }

        ];

    }

  

    handleShow(event) {

        this.messageService.add({

            severity: "success",

            summary: "ContextMenu onShow",

            detail: "Welcome to GeeksforGeeks"

        });

    }

    handleHide(event) {

        this.messageService.add({

            severity: "error",

            summary: "ContextMenu onHide",

            detail: "Welcome to GeeksforGeeks"

        });

    }

}

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment