我正在尝试使用解析设置推送通知来处理收到的通知.
我使用了phonegap-parse-plugin插件,并且能够正确设置它.
我的问题是我无法处理收到的通知.我想根据通知json params将用户重定向到通知页面.
所以,我决定切换到parse-push-plugin,但我的问题是我甚至无法显示警告注册框; 它甚至找不到ParsePushPlugin方法.
我按照教程很简单,并将其添加到我的app.js文件中
ParsePushPlugin.register(
{ appId:"xxx", clientKey:"xxx", eventKey:"myEventKey" }, //will trigger receivePN[pnObj.myEventKey]
function() {
alert('successfully registered device!');
},
function(e) {
alert('error registering device: ' + e);
});
ParsePushPlugin.on('receivePN', function(pn){
alert('yo i got this push notification:' + JSON.stringify(pn));
});
Run Code Online (Sandbox Code Playgroud)
警报成功未能显示,所以我猜它不起作用或我做的不对.
前段时间,我开始重构我的主项目代码,将业务逻辑从控制器解耦到服务,根据指南.一切顺利,直到我遇到循环依赖(CD)的问题.我读了一些关于这个问题的资源:
不幸的是,对我来说现在还不清楚,如何解决我项目的CD问题.因此,我准备了一个小型演示,它代表了我项目的核心功能:
组件简述:
问题1:gridMainService和gridDataService 之间存在循环依赖关系.第一个gridMainService使用gridDataService来加载具有以下功能的行数据:
self.loadRowData = function () {
// implementation here
}
Run Code Online (Sandbox Code Playgroud)
但是,gridDataService从服务器接收更新,并且必须在网格中插入一些行.所以,它必须使用gridMainService:
$interval(function () {
var rowToAdd = {
make: "VW " + index,
model: "Golf " + index,
price: 10000 * …
Run Code Online (Sandbox Code Playgroud) javascript dependency-injection circular-dependency angularjs
我有两个请求,第一个是 GET,第二个是 PUT。我应该接收来自 GET 请求的响应数据,稍微修改一下并使用 PUT 请求发送。到目前为止,除了修改响应数据之外,我已经完成了所有操作。
JSON 结构:
{
"property1" : 1,
"property2" : "2",
"innerPropery" : {
"innerProperty1" : "value1",
"innerProperty2" : "value2",
"innerProperty3" : "value3"
}
}
Run Code Online (Sandbox Code Playgroud)
我应该更改innerProperty2。
谢谢!