AngularJS动态图像源 [英] AngularJS dynamic image sources
本文介绍了AngularJS动态图像源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<img src="{{ twt.display }}"/>
我有上面的图像标记,其中src在范围内,但是当我查看浏览器控制台时log它显示以下内容
I have the above image tag where the src is in the scope but when I look at the browser console log it shows the following
资源被解释为图像但使用MIME类型
text / html传输: http://example.com/%7B%7Btwt.display%7D%7D 。
图像确实按预期显示但我想知道是否有办法阻止此消息出现?
The images do show as intended but I wanted to know if there was a way of stopping this message appearing?
推荐答案
使用 ng-src
以避免浏览器发出奇怪的无法传递的请求。
Use ng-src
to avoid strange undeliverable requests being made by browser.
一旦解析了 ng-src
中的表达式,它将更新 src
代码,
Once the expression in ng-src
is resolved, it will update the src
for the tag,
<img ng-src="{{twt.display}}"/>
这篇关于AngularJS动态图像源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文