[IONIC 4] [OneSignal] Load Specific

Hi guys,

I’ve been stuck on this for a while & am in urgent need of some help!

I’m trying to load a specific page when a notification is clicked on when the app is not open.

Things to note:

  • the loadPage function works fine as I am calling it elsewhere
  • the if statement is defo trigged ( I have tried without it)
  • the detailid variable isn’t empty, ( I have tried hardcoding an id)
var self = this;

.handleNotificationOpened(function (jsonData) {
    if (jsonData.payload.additionalData.template == 'news') {
        self.loadPage('/news-detail/' +  jsonData.payload.additionalData.detailid);
.handleNotificationReceived(function (jsonData) { ... })

any help would be really appreciated!!

First thing I would do is get rid of every use of the keyword function in your code to eliminate execution context as a point of failure.