Reputation: 139
I'm using the following code to receive data on my ionic app using firebase, i'm getting data.wastapped = true when the app is in background now i need to pass the data to my main controller,please help me to achieve this
FCMPlugin.onNotification(
function(data){
if(data.wasTapped){
alert(JSON.stringify(data);
// need to pass this data to my app controller
tapped by the user.
alert( JSON.stringify(data) );
}else{
alert( JSON.stringify(data) );
}
},
function(msg){
alert('onNotification callback successfully registered: ' + msg);
},
function(err){
alert('Error registering onNotification callback: ' + err);
}
Upvotes: 0
Views: 486
Reputation: 145
@Ram, Try using this below function
var scope = angular.element(document.getElementById('mainbody')).scope();
scope.$apply(function(){
//show popup regarding alert
scope.showdatas(data);
});
Upvotes: 1