1
我想從使用angularjs的json API中獲取圖像。 我正在使用一個html文件來獲取圖像,但我想我錯過了一些東西,它不起作用。 這裏是我的html:使用AngularJS和wordpress獲取來自JSON響應的圖像url
<li ng-repeat="post in posts">
<a ng-click="clickToOpen({{post.id}})">{{post.title}}</a><p> img src="{{post.attachments.url}}"></p>
</li>
我的JSON:
"attachments": [
{
"id": 15534,
"url": "http://www.grandlakebusinessjournal.com/wp-content/uploads/2013/02/Tera-Mirand-Shores-Platt-Phanse-One2.jpg",
"slug": "tera-mirand-shores-platt-phanse-one-3",
"title": "Tera Mirand Shores Platt Phanse One",
"description": "",
"caption": "",
"parent": 15455,
"mime_type": "image/jpeg",
"images": []
}
]
我試過用ng-src,但是不能正常工作 – user3584779
當你在inspect元素中檢查它時,你會在ng-src中綁定url嗎? –
我不明白 – user3584779