mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 08:20:13 +01:00
refactor(services): add use of observables
This commit is contained in:
parent
c86e92a9a9
commit
f690da083e
3 changed files with 45 additions and 33 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { NgaSidebarService, NgaMenuService } from '@akveo/nga-theme';
|
||||
import { NgaThemeService } from '@akveo/nga-theme/services/theme.service';
|
||||
|
|
@ -23,13 +23,13 @@ import { UserService } from '../../../@core/data/users.service';
|
|||
<nga-action icon="ion-ios-email-outline"></nga-action>
|
||||
<nga-action disabled icon="ion-ios-bell-outline"></nga-action>
|
||||
<nga-action>
|
||||
<nga-user [menu]="userMenu" [name]="user.name" [picture]="user.picture"></nga-user>
|
||||
<nga-user [menu]="userMenu" [name]="user?.name" [picture]="user?.picture"></nga-user>
|
||||
</nga-action>
|
||||
<nga-action icon="ion-ios-gear-outline"></nga-action>
|
||||
</nga-actions>
|
||||
`,
|
||||
})
|
||||
export class HeaderComponent {
|
||||
export class HeaderComponent implements OnInit {
|
||||
|
||||
user: any;
|
||||
|
||||
|
|
@ -46,7 +46,11 @@ export class HeaderComponent {
|
|||
private menuService: NgaMenuService,
|
||||
private themeService: NgaThemeService,
|
||||
private userService: UserService) {
|
||||
this.user = this.userService.getUsers().nick;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.userService.getUsers()
|
||||
.subscribe((users: any) => this.user = users.nick);
|
||||
}
|
||||
|
||||
toggleSidebar(): boolean {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue