2

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

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.