简体   繁体   English

在 AngularJS 中显示图像

[英]Display image in AngularJS

Not sure why my image's aren't being loaded by angular, here's what I've got:不知道为什么我的图像没有被 angular 加载,这是我得到的:

<li class="list-group-item" ng-repeat="family in product.families | orderBy:'category'">
    <h3>{{family.category}}</h3>
    <div class="img-wrap">
        <img ng-src="{{family.image}}"/>
    </div>
</li>

family.category works, but my ng-src does not seem to be. family.category有效,但我的ng-src似乎不是。 When I look in the HTML of the loaded page all I see is <img ng-src>当我查看加载页面的 HTML 时,我看到的只是<img ng-src>

JSON Sytnax JSON 语法

"families": [
    {
      "category": "Tablets",
      "image": "images/tablet.png"
    }
]

You can take a look at the live version of this here您可以在此处查看实时版本

Make sure image url is correct, try complete image url in json.确保图像 url 正确,在 json 中尝试完整的图像 url。

In chrome dev tools-> network check which url it in invoking.在 chrome 开发工具-> 网络中检查调用它的网址。

-- ——

I have low reputation can't comment.我名气低不能评论。

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

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