【发布时间】:2015-04-24 00:43:25
【问题描述】:
我正在开发一个 Cordova/PhoneGap 应用程序,并且我正在使用 $cordovaPush 插件(为 PushPlugin 包装)来处理推送通知。
代码如下所示:
var androidConfig = {
"senderID" : "mysenderID",
"ecb" : "onNotification"
}
$cordovaPush.register(androidConfig).then(function(result) {
console.log('Cordova Push Reg Success');
console.log(result);
}, function(error) {
console.log('Cordova push reg error');
console.log(error);
});
“ecb”函数必须定义窗口作用域,即:
window.onNotification = function onNotification(e)...
此函数处理传入事件。我显然想在我的 Angular 代码中处理传入事件 - 我如何整合这两者以便我的 onNotification 函数可以访问我的范围/rootScope 变量?
【问题讨论】:
标签: javascript angularjs