I am working with webapp2 and Angular's $resource, I am having hard time finishing the job and resolving my data array from JSON format within my controller.
in my python handler, the array wrapper to JSON format is as follows:
self.response.write(json.encode(self.getVertices()))
and here is my service code in Angular:
angular.module('myPage').service('onServices',['$resource','$q',
function($resource,$q){
this.getMesh = function(){
var Mesh = $resource('/context/actors/one',
{}, {get: {method:'GET', isArray:true,responseType:'json'}})
return Mesh.get().$promise.then(function(data) {
one = data
return one})
}
}]);
and my controller code is this:
$scope.bck = onServices.getMesh();
when I log 'data' inside the service, it shows as series of 'resource' each of which containing a row of the array. And when I log the data inside the controller, it is still in 'promise' format, which contains the series of 'resource' (array rows). I can see the data inside the promise, but I am not seeing the data in the expected format, which is JSON. thanks.