編輯: TIL你不需要在範圍中添加url。另外,要小心鑰匙,謝謝。以角js圖像的URL
我想表現出一個HTML5文檔一些圖像和它的名字,這裏的指數:
<div ng-repeat="producto in productos">
<figure class="floating">
<img ng-src="{{ image }}" alt="Macaque in the trees" class="rcorners3" style='width:100%;' border="0" alt="Null">
<figcaption>{{ name }}</figcaption>
</figure>
</div>
在頂部,我有:
<body ng-app="app">
<div class="main" ng-controller="app">
這是怎麼MainController .js文件看起來像:
app.controller('app', ['$scope', function ($scope) {
$scope.productos = [{
name : 'Management Guides',
image : url('managemant-guides.jpg')
}, {
name : 'Leaflets',
image : url('managemant-guides.jpg')
}, {
name : 'Production Charts',
image : url('managemant-guides.jpg')
}, {
name : 'Technical Guides',
image : url('managemant-guides.jpg')
}, {
name : 'Poultry News',
image : url('managemant-guides.jpg')
}
];
}]);
我tihnk我未能在NG-SRC點,不
謝謝你,我得到一個白色的頁面aplying您的解決方案後,說URL沒有定義,所以我修改了控制器的陣列也是如此。感謝您的幫助。 – xxxxxxxxxxxxx