Reputation: 238
How get Hashmap from rest and put it in $result AngularJs.
I tried:
angular.module('myApp')
.controller('EntitesController', function ($scope, $stateParams, Entites) {
$scope.all = {};
$scope.load = function (id) {
Entites.get({id: id}, function (result) {
$scope.all = result;
});
};
$scope.load($stateParams.id);
});
But in all - nothing. I`m sure thar rest give Hasmap but i have no idea how put this hashmap in result.
Please help
Upvotes: 2
Views: 9146
Reputation: 370
What about something like:
webPortalApp.controller(
'AboutController',
function($scope, $log, $http) {
$log.log('Creating request...');
var req = {
method: 'GET',
url: 'rest/app/information/'
};
$log.log('Executing request...');
$http(req).success(
function(data) {
$scope.properties = data;
}
).error(
function(data) {
$scope.properties = 'unknown';
}
);
$log.log('Executed request.');
});
and:
<div><table class="table table-striped table-bordered">
<tbody>
<tr ng-repeat="(k,v) in properties">
<td>{{ k }}</td>
<td>{{ v }}</td>
</tr>
</tbody>
</table></div>
Upvotes: 1