javascript - Azure 移动服务 Javascript 库和更新 - 无法读取方法

标签 javascript promise azure-mobile-services

取此 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/

相关文章:

javascript - Bluebird Promise.bind() 的困难

c# - 如何从 Xamarin.Forms 使用 Azure 移动服务?

javascript - 如何在 SailsJS/Waterline 中使用 Model.query() 和 Promise?

javascript - 如何让 AngularJS 的两个页面共享同一个 $scope?

javascript - 我公司的 UI 设计师和营销人员不想要 "awkward line breaks"。 CSS 或 JS 怎么办?

javascript - javascript中++和+=1的区别

javascript - 使用 Dexie 和 Svelte 从 IndexedDB 中检索值

azure - Xamarin Forms 和 Azure Easy Tables 同步问题

azure-mobile-services - 添加 "Azure Mobile Apps Table Controller"时出错

javascript - 如何使用 jQuery 获取文本输入的所有值?