asp.net - 获取错误 403 图像 Angular

标签 asp.net angularjs servicestack

服务器响应我的文档(Json 格式)并包含信息。在这个 json 中我有一个图像的 url。每次当我加载页面的新内容(带有新图像)时,它都会出现,但在控制台中出现错误:

enter image description here

我使用 Angular 中的 json 中的 url 在我的网站上显示图像。

来自 fiddler 的更多信息: enter image description here

Chrome 加载图像中的屏幕: enter image description here

帮我解决这个问题。

最佳答案

代替 src 属性 在 html 标记中将 url 绑定(bind)到 json 响应时设置 ng-src 。类似的东西

<img ng-src="{{content.imageUrl}}"/>

使用src会导致浏览器在绑定(bind)解析之前发出请求。

更多详情here

关于asp.net - 获取错误 403 图像 Angular ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18356466/

相关文章:

javascript - 如何在 Selenium webdriver 中使用 cssSelector 识别多个参数

asp.net - ServiceStack - 返回类时为空 json

c# - 如何告诉谷歌我有另一个页面?

c# - 托管在 IIS/Asp.NET 应用程序中的 HttpClient 证书不起作用

javascript - 使用 Angular 添加事件状态到列表项

html - UI-select 下拉选项未显示在面板正文上方

ServiceStack 服务器发送的事件 - 参数化 channel ?

events - ServiceStack中的ServerEventsClient并发模型

c# - 连接的 SQL 列返回空值,是否有解决方法?

asp.net - Visual Studio 2005 无法在发布配置模式下编译