xlmnxp / nativescript-menu

A plugin that adds a pop-up menu to NativeScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make actions clickable

ravinaparab1 opened this issue · comments

i need to make the actions clickable to enable function call. How can it be achieved?

you can do it by write

    Menu.popup({
      view: this.page.getViewById("menuBtn"),
      actions: ["Example", "NativeScript", "Menu"]
    })
      .then(value => {
            if(value == "Example"){
                callExampleFunction();
            } else if(value == "NativeScript"){
                callNativeScriptFunction();
            } else if(value == "Menu"){
                callMenuFunction();
            } else {
                callElseFunction();
            }
      })
      .catch(console.log);