2017-05-08 1 views
0

J'utilise le code suivant pour recevoir des données sur mon application ionique en utilisant firebase, je reçois data.wastapped = true lorsque l'application est en arrière-plan maintenant je dois transmettre les données à mon contrôleur principal, s'il vous plaît aidez-moi à atteindre cetCordova FCM plugin gérer les données de notification d'arrière-plan

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); 
         } 

Répondre

0

@Ram, Essayez d'utiliser cette fonction ci-dessous

var scope = angular.element(document.getElementById('mainbody')).scope(); 
scope.$apply(function(){ 
      //show popup regarding alert   
      scope.showdatas(data); 
     });