I'm implementing push notification service. I want send a variable e.regid to AppCtrl controller in AngularJS. Could any one help me solving this problem..?
PushCustom.js
function onNotification(e) {
switch (e.event) {
case 'registered':
if (e.regid.length > 0) {
// Your GCM push server needs to know the regID before it can push to this device
// here is where you might want to send it the regID for later use.
//alert("regID = " + e.regid);
AppCtrl(e.regid);
}
break;
case 'message':
if (e.foreground) {
var soundfile = e.soundname || e.payload.sound;
var my_media = new Media("/android_asset/www/" + soundfile);
my_media.play();
}
break;
case 'error':
break;
default:
break;
}
}
app.js
app.controller('AppCtrl',
['$scope','$http', function($scope, $http, e.regid){
alert(e.regid);
$scope.regid = e.regid;
}]);
Anyone got any idea on how to make this work? Thanks!