Get the data object underlying Angular $ resource get () Response Object

Problem

$ resource does not return raw JSON object

Explanation

When I use the get () method on the ng $ resource class, a Resource object is returned to me that has the data I want, as well as additional features like $ prom and $ resolved.

For example, I have:

Resource {
id: "5400c95b70726518d1020000", 
title: "Treeview", 
objective: null, 
nodes: Array[1], 
$promise: Object…}
$promise: Object
$resolved: trueid: "5400c95b70726518d1020000"nodes: Array[1]
0: Objectlength: 1__proto__: Array[0]objective: nulltitle: "Treeview"__proto__: Resource}

      

I'm sure this is really helpful for a lot of people, but what I really want is:

{id: "5400c95b70726518d1020000", title: "Treeview", objective: null, nodes: Array[1]}

Is there an easy way to access the object I wanted to return without all the decorations?

+3
angularjs angular-resource


source to share


No one has answered this question yet

Check out similar questions:

119
How to filter an object property in angularJS
3
Angular Resource Save Promise
1
AngularJS: POST changes to server using $ resource
1
AngularJS is waiting for $ resource response to set value
1
Getting a binary from an angular resource
1
AngularJS - Comparing Resources and Objects
1
The $ angular resource gets a single entry. Answer, but no data
0
How to use angularjs $ q.all () with asynchronously generated promise array
0
AngularJS: accessing array in $ resource object
0
Getting object data from AngularJS $ resource request without resource functions



All Articles
Loading...
X
Show
Funny
Dev
Pics