取此 site 中的代码示例。以下简化代码生成以下 JavaScript 错误:TypeError: Object #<Promise> has no method 'read'
代码:
Azure.notification = client.getTable('notification');
var a = Azure.notification.update({
id: id,
isRead: true
}).read().done(function (result) {
console.log(result);
}, function (err) {
});
链接中引用的代码几乎相同。我能看出的唯一区别是我在 Azure
中保存了对几个不同表的引用。对象并且查询数据没有任何问题,仅此更新。我正在寻找如何确定更新是否成功。
todoItemTable.update({
id: idToUpdate,
text: newText
}).read().done(function (result) {
alert(JSON.stringify(result));
}, function (err) {
alert("Error: " + err);
});
最佳答案
经过进一步研究,以下页面似乎不同,使用 then
和 Promise 回调。
todoItemTable.update({ id: getTodoItemId(this), complete: isComplete })
.then(refreshTodoItems);
http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-data-html/
我不确定是我整个周末工作太累还是文档有问题。
关于javascript - Azure 移动服务 Javascript 库和更新 - 无法读取方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16888060/