问题标签 [nstore]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
angularjs - How to get $resource key to pass to a view in AngularJS?
I need to get the resource key from an array of resources in my AngularJS SPA. I use a resource like this:
It connects to my node.js backend which loads JSON from nstore. The "API" is simply getting data out of a nStore db, I just do a res.end(result)
sending my result like this:
When I do give a parameter (like, calling "/api/answers/1moabd0c" from that first object), I get only that one result, like this:
So how do I extract that object key?
I use the resources in a view:
But it does not work. I tried using {{asnwer.key}}, {{answer.id}} there...what else can I use to get that hash?
Edit: when I do this in my controller:
And then in the window I log out x, I get an array, but that array has $$hashKey
props. My guess those are angulars' own hash keys. I need the original ones. The array looks like this (edited it a bit to fit here nicely)