From 5045b810c84accf5d6c8d10d57bb5d83ad70a549 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio <giuseppe.digilio@4science.it> Date: Wed, 14 Mar 2018 13:26:58 +0100 Subject: [PATCH] Fixed notifications --- .../notification/notification.component.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/app/shared/notifications/notification/notification.component.ts b/src/app/shared/notifications/notification/notification.component.ts index 619c9b513a..c242853064 100644 --- a/src/app/shared/notifications/notification/notification.component.ts +++ b/src/app/shared/notifications/notification/notification.component.ts @@ -129,15 +129,17 @@ export class NotificationComponent implements OnInit, OnDestroy { this[key] = item; } else if (key === 'title' || key === 'content') { let value = null; - if (typeof item === 'string') { - value = Observable.of(item); - } else if (item instanceof Observable) { - value = item; - } else if (typeof item === 'object' && isNotEmpty(item.value)) { - // when notifications state is transferred from SSR to CSR, - // Observables Object loses the instance type and become simply object, - // so converts it again to Observable - value = Observable.of(item.value); + if (isNotEmpty(item)) { + if (typeof item === 'string') { + value = Observable.of(item); + } else if (item instanceof Observable) { + value = item; + } else if (typeof item === 'object' && isNotEmpty(item.value)) { + // when notifications state is transferred from SSR to CSR, + // Observables Object loses the instance type and become simply object, + // so converts it again to Observable + value = Observable.of(item.value); + } } this[key] = value } else { -- GitLab