[develop | DONE | FIXED]: userMini.component.ts Added a class field isClient: boolean = false; and set it in constructor with "this.isClient = !isPlatformServer(this.platform);" statement & added checks not to display dropdowns on server (needed also for non destructive hydration).
This commit is contained in:
parent
e66192172a
commit
980fc6a34a
|
@ -1,4 +1,14 @@
|
|||
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild} from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
Inject,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnInit,
|
||||
Output, PLATFORM_ID,
|
||||
SimpleChanges,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {Session, User} from './utils/helper.class';
|
||||
import {RouterHelper} from '../utils/routerHelper.class';
|
||||
|
@ -9,6 +19,7 @@ import {
|
|||
NotificationConfiguration,
|
||||
NotificationsSidebarComponent
|
||||
} from "../notifications/notifications-sidebar/notifications-sidebar.component";
|
||||
import {isPlatformServer} from "@angular/common";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -27,7 +38,7 @@ declare var UIkit;
|
|||
</text>
|
||||
</svg>
|
||||
</a>
|
||||
<div class="uk-navbar-dropdown uk-dropdown" uk-dropdown="pos: bottom-right">
|
||||
<div *ngIf="isClient" class="uk-navbar-dropdown uk-dropdown" uk-dropdown="pos: bottom-right">
|
||||
<ul class="uk-nav uk-navbar-dropdown-nav">
|
||||
<ng-container *ngFor="let item of userMenuItems ">
|
||||
<li *ngIf="item.needsAuthorization && isAuthorized || !item.needsAuthorization"
|
||||
|
@ -117,6 +128,7 @@ declare var UIkit;
|
|||
`
|
||||
})
|
||||
export class UserMiniComponent implements OnInit, OnChanges {
|
||||
isClient: boolean = false;
|
||||
@Input() user: User;
|
||||
public loggedIn: boolean = false;
|
||||
public isAuthorized: boolean = false;
|
||||
|
@ -129,7 +141,9 @@ export class UserMiniComponent implements OnInit, OnChanges {
|
|||
public showNotifications = false;
|
||||
private subscriptions = [];
|
||||
|
||||
constructor(private router: Router, private route: ActivatedRoute, private userManagementService: UserManagementService) {
|
||||
constructor(private router: Router, private route: ActivatedRoute, private userManagementService: UserManagementService,
|
||||
@Inject(PLATFORM_ID) private platform: any) {
|
||||
this.isClient = !isPlatformServer(this.platform);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
|
Loading…
Reference in New Issue