GithubHelp home page GithubHelp logo

userMenu call function about nebular HOT 10 CLOSED

akveo avatar akveo commented on July 23, 2024 1
userMenu call function

from nebular.

Comments (10)

sKaouech avatar sKaouech commented on July 23, 2024 6

@miguelleitevieira
you can do this :
userMenu = [
{ title: 'Profile' },
{ title: 'Log out', link: '/logout' }
];

from nebular.

miguelleitevieira avatar miguelleitevieira commented on July 23, 2024 2

@nnixaa I have a doubt.

I'm trying to add a function to the logout option.

userMenu = [
{ title: 'Profile' },
{ title: 'Log out', click: console.log('/login') }
];

But this runs when the class is instantiated.

You know how I can solve this?

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024 1

Hey @jogamod would you mind sharing your code? As <user (menuClick)="onMenuClick($even)"> should work.

from nebular.

YukiDmZhao avatar YukiDmZhao commented on July 23, 2024

I meet to so problem, How to do? maybe have code example?

from nebular.

YukiDmZhao avatar YukiDmZhao commented on July 23, 2024

<nb-user [menu]="userMenu" [name]="user?.name" [picture]="user?.picture" (menuClick)="onMenuClick($even)">

from nebular.

YukiDmZhao avatar YukiDmZhao commented on July 23, 2024

<nb-user [menu]="userMenu" [name]="user?.name" [picture]="user?.picture" (menuClick)="onMenuClick($even)">
is error
How to setting?

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024

@YukiDmZhao what errors are you getting?

from nebular.

YukiDmZhao avatar YukiDmZhao commented on July 23, 2024

onMenuClick($even){
console.log('$even======>',$even);
}
$even======> undefined
can not run I want to function

from nebular.

nnixaa avatar nnixaa commented on July 23, 2024

@YukiDmZhao it should be $event with t and the end in your template.

from nebular.

hosseinGanjyar avatar hosseinGanjyar commented on July 23, 2024

@sKaouech very good tick...
I used of routerlink into logout function that has a problem and redirected to login page.

logOut() {
     this.authService.logout('email')
     this.router.navigate(['/auth/logout']);
  }

@nnixaa Why past my solution has a problem?

from nebular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.