Knockout JS图像绑定

时间:2013-03-11 21:40:01

标签: asp.net knockout.js asp.net-web-api

我在单页应用程序中使用knockout js。我有一个文件上传输入标签,我正在使用knockout来上传文件。在这种情况下,上传的文件是图像。

一旦我的ASP.NET Web API处理了图像,并且它返回到我的回调函数中,我将响应插入到一个可观察的数组中,该数组会使用添加的新图像和文本来更新屏幕。 / p>

但是,由于某种原因,图像未显示。如果我刷新页面,它会很好地加载图像,但是当添加到可观察数组时,它不会显示图像。

有什么想法吗?

修改:这是我添加项目的代码,非常简单。

 item = {
                                "insightTypeId": 0,
                                "memberId": currentMemberId(),
                                "postedByMemberId": store.fetch("currentUser"),
                                "value": insight(),
                                "image": "content/insights/" + fileName
                            };

  messaging.client.addItem = function(item) {
        member().insights.unshift(item);
    };

更新

忘记提及它在浏览网站的计算机上运行正常,但在手机上它不起作用。

1 个答案:

答案 0 :(得分:0)

我发现这是一个移动旅行资源问题