flauc / angular2-notifications

A light and easy to use notifications library for Angular.
https://stackblitz.com/edit/angular2-notifications-example
MIT License
746 stars 163 forks source link

Can I change the `theClass` property of an existing notification? #340

Open sebastientromp opened 5 years ago

sebastientromp commented 5 years ago

When I receive a certain event, I'm doing this kind of logic:

// activeNotifications is a wrapper around the Notification object with additional domain-specific metadata.
const activeNotif = this.activeNotifications.find((notif) => notif.cardId === cardId);
if (activeNotif != null) {
    const toast = activeNotif.toast;
    toast.theClass = 'active';
    console.log('active notif found', activeNotif, toast);
}

However, the active class isn't set in the existing notification. Do you know if this behavior is supported? Can I cache the Notification object? If not, do I have an option to retrieve the notification (using an ID or something) from the NotificationsService?

Thanks!