Fixed notifications

This commit is contained in:
Giuseppe Digilio
2018-03-14 13:20:05 +01:00
parent 360784c1bb
commit d3949c17e1

View File

@@ -128,11 +128,18 @@ export class NotificationComponent implements OnInit, OnDestroy {
if (item instanceof TemplateRef) { if (item instanceof TemplateRef) {
this[key] = item; this[key] = item;
} else if (key === 'title' || key === 'content') { } else if (key === 'title' || key === 'content') {
this[key] = isNotEmpty(item) ? let value = null;
typeof item === 'string' ? if (typeof item === 'string') {
Observable.of(item) value = Observable.of(item);
: typeof item === 'object' && isNotEmpty(item.payload) ? Observable.of(item.payload) : null } else if (item instanceof Observable) {
: null; 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 { } else {
this[key] = this.domSanitizer.bypassSecurityTrustHtml(item); this[key] = this.domSanitizer.bypassSecurityTrustHtml(item);
} }