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


source to share





All Articles