[英]AngularJS displaying image using base64 string
I have an image stored in my database and I want to use angular to display it. 我有一个图像存储在数据库中,我想使用angular来显示它。 The HTML for my page looks like this:
我页面的HTML如下所示:
<img ng-if="controller.model.logo && !controller.result" ng-src="{{ controller.model.logo }}" />
And the model looks like this: 该模型如下所示:
{
"id":1,
"name":"Test",
"logo":"data:image/gif;base64,R0lGODlhGAQHAfcAAI6Sls3O1NPT1picpLq9xfv47t/j5ZWWm73Dy…I+amVcIIqn6qQAIVtzzkZiomiCBB0lMUMqg79LXKqAJJL3xuJe4hwBRiB9CV9CgpcsNzECAgA7",
"theme":"black",
"centers":null
}
but the image is not displaying. 但图像未显示。 Am I doing something wrong?
难道我做错了什么?
Try this 尝试这个
<img ng-if="controller.model.logo && !controller.result" ng-src="{{controller.model.logo}}" />
using string interpolation for the ng-src
attribute 对
ng-src
属性使用字符串插值
您需要做:
<img ng-if="controller.model.logo && !controller.result" ng-src="{{controller.model.logo}}" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.