javascript - POST Request not returning array from API - ngresource -
i'm trying learn angularjs , on ngresource part.
what i'm trying post request api return me array information in console log after button click.
/*---------service----------*/ app.factory('gettablegriddataservice', function ($resource) { return $resource('api-url-adress', {}, { 'save': { method: 'post' } }) }); /*---------controller--------*/ $scope.fillrealtable = function () { alert('getting data...'); var arraybody = {}; var query = gettablegriddataservice.save({}, arraybody); query.$promise.then(function (data) { var loggitemlist = data; alert('done!'); $scope.loggitems = loggitemlist console.log($scope.loggitems); alert('console log displayed!') }) }
<!--button--> <button type="button" class="btn btn-default pull-right" style="margin-top:20px;" ng-click="fillrealtable()">console log result</button>
so in console log structure of array nothing in it..
i know have pass body or something, couldn't find out how done correct way, or maybe found couldn't understand telling me haha :p
anyways..the console.log result this:
hope understand... sorry inconvenience if any. in advance!
Comments
Post a Comment