javascript - Restangular getList() method not returning JSON -


i have problem geting data restangular promise. promise instead of pure data in json.

this response api

localhost:3000/api/meal

{  "status": "success",  "data": [    {      "meal_id": 4,      "meal_type_id": 2,      "description": "blahblah",      "price": "3.50",      "info": "120/120/20g",      "restaurant_id": 2    },      ...      ... }  ],  "message": "retrieved meals" } 

this config method extracting data response

 restangularprovider.addresponseinterceptor(function(data, operation, what, url, response, deferred) {   var extracteddata;   // .. getlist operations   if (operation === 'getlist') {     // .. , handle data , meta data    return data.data;    } else {     extracteddata = data.data;   }   return extracteddata; }); 

this how trying data api

  restangular.all('meal').getlist().then(function(meals) {      $scope.menu = meals; //meals.plain()       console.log($scope.menu);  }); 

but response

enter image description here enter image description here

i need json array "data" field using in application.

sry guys, after hours of research , debuging found bug in backend api in 1 specific select. express.js, pg-promise , application works correctly.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -