2017-05-08 27 views
0

firebase를 사용하여 내 이차 앱에서 데이터를 수신하려면 다음 코드를 사용합니다. 앱이 백그라운드에있을 때 data.wastapped = true가 표시됩니다. 이제 데이터를 전달해야합니다. 내 메인 컨트롤러는이Cordova FCM 플러그인 백그라운드 알림 데이터 처리

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

답변

0

@Ram을 달성 기능 아래에이를 사용해보십시오 저를 도와주세요

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