Menu Service not registering events/clicks and calling functions
- Dominant language
- TypeScript
- Stars
- 25.7k
- Forks
- 7.9k
- PR merge metrics
- No merged PRs in 30d
Description
### Issue type
**I'm submitting a ...** (check one with "x")
* [X ] bug report
* [ ] feature request
* [ ] question about the decisions made in the repository
### Issue description
on I am using the context menu and passing the nbContextMenuTag param and registering to events using NbMenuService , but the actions are not triggered.
**Current behavior:**
The click action does not signout the user
**Expected behavior:**
**Steps to reproduce:**
**Related code:**
```
insert short code snippets here
```
headerComponent.html
```
```
HeaderComponent.ts
```
export class HeaderComponent implements OnInit {
@Input() position = 'normal';
user: any;
userMenu = [{ title: 'Profile', link:['pages/profile'] }, { title: 'LogOut' }];
constructor(private sidebarService: NbSidebarService,
private menuService: NbMenuService,
private auth: AuthService
) {
}
ngOnInit(): void {
//Called after the constructor, initializing input properties, and the first call to ngOnChanges.
//Add 'implements OnInit' to the class.
this.auth.user.pipe(take(1), map(user => this.user = user));
this.menuService.onItemClick()
.pipe(
filter(({ tag }) => tag === 'user-menu'),
map(({ item: { title } }) => title),
tap(title => {
console.log(title);
if(title === 'LogOut' ) {
this.auth.signOut()
}
})
)
}
```
### Other information:
**npm, node, OS, Browser**
```
node --version
v11.2.0
npm --version
6.4.1
OS MacOS High Sierra
Browser Chrome and Firefox
```
**Angular, Nebular**
```
```
"dependencies": {
"@angular/animations": "~7.0.0",
"@angular/cdk": "~7.0.0",
"@angular/common": "~7.0.0",
"@angular/compiler": "~7.0.0",
"@angular/core": "~7.0.0",
"@angular/fire": "^5.1.1",
"@angular/forms": "~7.0.0",
"@angular/http": "~7.0.0",
"@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0",
"@angular/router": "~7.0.0",
"@nebular/auth": "^3.0.0",
"@nebular/bootstrap": "^3.0.0",
"@nebular/security": "^3.0.0",
"@nebular/theme": "^3.0.0",
"@ng-bootstrap/ng-bootstrap": "^4.0.0",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"firebase": "^5.6.0",
"nebular-icons": "^1.1.0",
"rxjs": "~6.3.3",
"zone.js": "~0.8.26"
},
Contributor guide
Assessment
This issue has not been assessed yet.