简体   繁体   English

BB10科尔多瓦, <img ng-src=“”> 图片未加载

[英]BB10 Cordova, <img ng-src=“”> images not loading

I have BB10 cordova app, In view I have 我有BB10 cordova应用,我认为

<img ng-src="{{'someImageLink'}}">

And some local images not showing, there is blue question mark. 并且一些本地图像未显示,有蓝色问号。 But if I will change to 但是如果我改变为

<img src="someImageLink">

img works perfectly img工作完美

Changing to 更改为

<img src="{{'someImageLink'}}">

not helping at all 根本没有帮助

Can't diagnose, do you mby have any ideas or know how to fix this issue on BB10? 无法诊断,您是否有任何想法或知道如何在BB10上解决此问题?

You're close! 你近了! Since Angular already evaluates the contents of ng-src, you do not need to wrap your expression in {{ }} braces: 由于Angular已经评估了ng-src的内容,因此您无需将表达式包装在{{}}花括号中:

$scope.imageLink = "image.png";

<img ng-src="imageLink">

After being evaluated, this will leave you with the equivalent of this, in the DOM: 经过评估后,这将使您在DOM中拥有与之等效的功能:

<img src="image.png">

If you're using a hardcoded string to a local image file, and it will never ever change in your app, there's nothing wrong with using src="image.png" directly. 如果您在本地图像文件中使用硬编码字符串,并且该字符串永远不会在您的应用程序中更改,则直接使用src="image.png"

I hope this helps! 我希望这有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM