无法从数据库加载图像(图像在byte []中) 下面是我的代码
<div ng-app="MyProductApp">
<h1>Category List</h1>
<div ng-controller="ProductsController">
<table>
<tr ng-repeat="category in Category | orderBy : 'CategoryName'">
<td><a ng-click="redirectToProductWiseCategories($event)" id="{{category.CategoryID}}">{{category.CategoryName}}</a></td>
<td>
<img ng-src="data:image/JPEG;base64,{{category.Picture}}" alt="img" />
</td>
</tr>
</table>
</div>
</div>
以下是我的方法,请问我在这里做错了什么。答案将非常感激。提前谢谢
<script>
var app = angular.module("MyProductApp", []);
app.controller("ProductsController", function ($scope, $http) {
$http.get('/api/Products/GetAllCategories').
success(function (data, status, headers, config) {
//debugger;
$scope.Category = data;
}).
error(function (data, status, headers, config) {
alert("erro");
});
});
</script>
答案 0 :(得分:2)
试试这个,
<div ui-sref="task" class="col-lg-3 col-md-5 col-sm-6" ng-repeat="x in tasklist|filter:searchString">
<div class="main-box clearfix profile-box">
<div class="main-box-body clearfix">
<div class="profile-box-header" padding-bottom:222px;">
<img src="{{x.imageUrl}}"/>
<div style=""></div>
</div>
<div class="profile-box-footer clearfix" >
<span class="value" > {{x.title}}</span>
<span>{{x.description}}</span>
&#13;
imageUrl是数据库中的一个字段,在那里我存储了我的图像并像这样存储。