Image retrieval using Angular-Datatables & Spring MVC
Image retrieval using Angular-Datatables & Spring MVC
I am new to angular data tables and in my project, I am using Spring MVC and angular data tables to retrieve an image stored as byte array in my postgresql table. I use the java entity in angularjs to connect to database. When I retrieve the byte array stored, it gives me null values.
function EmpController(Employee, $scope, $http, $compile, $filter, $modal, $timeout,
DTOptionsBuilder, DTColumnBuilder, DTInstances) {
var vm = this;
vm.dtOptions = createDefaultDtOptions('users/list', null, 'loginName', null,
$scope, $http, $compile, DTOptionsBuilder,null,true);
vm.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID'),
DTColumnBuilder.newColumn('person').withTitle('Person Name')
.renderWith(function (data) {
alert("Data: " + data);
return data ? data.person : '';
}),
DTColumnBuilder.newColumn('loginName').withTitle('User Name'),
DTColumnBuilder.newColumn('rowCreated').withTitle('Created Date')
.renderWith(function (data) {
return $filter('date')(data, appConfig.timestampFormat);
}),
DTColumnBuilder.newColumn('enabled').withTitle('Enabled'),
DTColumnBuilder.newColumn('passwordExpired').withTitle('Password Expired'),
createDefaultActionsDtColumn(DTColumnBuilder, null, null, true)
];
}
The alert gives me Data: null everytime I retrieve a record