Notification Banner animation


#1

Hi,
I need to show an in-app notification banner whenever a push notification comes.
I am using fcm for notifications and here’s the code for handling notification in app.ts:

this.fcm.onNotification().subscribe(data=> {
if(data.wasTapped) {
// Do something when app is in background.
}
else {
// Do something when app is open.
// I am writing my code here
}
}

Now I have HTML for the banner in app.html and it works when I open the app and notification came for the first time, but for the notifications after that, it doesn’t work.

I tried to use the workaround given here but then it throws an error:
console.error: Unhandled Promise rejection: null is not an object (evaluating 'element.classList'

Is there any way to make it work?