Ah!
ok, can you try the following:
function RESTClient($scope, $resource) {
$scope.URL=URL;
$scope.data = $resource(URL,
{ callback:'JSON_CALLBACK'},
{get:{method:'JSONP'}});
$scope.data.get(function (x) {
$scope.users = x;
console.log(x)
});
}
Regards
Sander
function RESTClient($scope, $resource) { $scope.URL=URL; $scope.data = $resource(URL, { callback:'JSON_CALLBACK'}, {get:{method:'JSONP'}}); $scope.data.get(function (x) { $scope.users = x; console.log(x) }); }
{"ok": 1, "results": [{"_id": {"$oid": "52c7d8e20dd0bc6d1c000001"}, "name": "Yvonec"}, {"_id": {"$oid": "52c7d8e20dd0bc6d1c000002"}, "name": "Lilwenn"}, {"_id": {"$oid": "52cb22116d3c20e905f23239"}, "name": "Toto"}], "id": 2}
I've changed a bit the js :[{"name":"Yvonec","_id":{"$oid": "52c7d8e20dd0bc6d1c000001"}},{"name":"Lilwenn","_id":{"$oid": "52c7d8e20dd0bc6d1c000002"}},{"_id":{"$oid": "52cb22116d3c20e905f23239"},"name":"Toto"}]
Resulting in NOTHING at console.log...
log at the server side :
$ python httpd.py
=================================
| MongoDB REST Server |
=================================
listening for connections on http://localhost:27080
1.0.0.127.in-addr.arpa - - [07/Jan/2014 12:59:45] "GET /test/users/_find?callback=angular.callbacks._0 HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:00:23] "GET /test/users/_find HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:01:38] "GET /test/users/_find HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:01:51] "GET /test/users/_find?callback=angular.callbacks._0 HTTP/1.1" 200 -
1.0.0.127.in-addr.arpa - - [07/Jan/2014 13:02:33] "GET /test/users/_find?callback=angular.callbacks._0 HTTP/1.1" 200 -
=============================================================================
and finally with NodeJS / mongodb-rest :
http://localhost:3000/test/users
[ { "name": "Yvonec", "_id": "52c7d8e20dd0bc6d1c000001" }, { "name": "Lilwenn", "_id": "52c7d8e20dd0bc6d1c000002" }, { "_id": "52cb22116d3c20e905f23239", "name": "Toto" } ]
Resulting in NOTHING at console.log...
server log being :However looking the repos I've found :
$ mongodb-rest
Warning: express.createServer() is deprecated, express
applications no longer inherit from http.Server,
please use:
var express = require("express");
var app = express();
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
========================================================================================
= Please ensure that you set the default write concern for the database by setting =
= one of the options =
= =
= w: (value of > -1 or the string 'majority'), where < 1 means =
= no write acknowledgement =
= journal: true/false, wait for flush to journal before acknowledgement =
= fsync: true/false, wait for flush to file system before acknowledgement =
= =
= For backward compatibility safe is still supported and =
= allows values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}] =
= the default value is false which means the driver receives does not =
= return the information of the success/error of the insert/update/remove =
= =
= ex: new Db(new Server('localhost', 27017), {safe:false}) =
= =
= http://www.mongodb.org/display/DOCS/getLastError+Command =
= =
= The default of no acknowledgement will change in the very near future =
= =
= This message will disappear when the default safe is set on the driver Db =
========================================================================================
127.0.0.1 - - [Tue, 07 Jan 2014 12:13:14 GMT] "GET /test/users HTTP/1.1" 304 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:29.0) Gecko/20100101 Firefox/29.0"
|
Ruby / DrowsyDromedary latest change drowsy_dromedary.rb 5 months ago |
|
may be the REST specification itself isn't the same... ANyway, thanks a lot for your help ! |
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/uf_hoX9W8P8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/uf_hoX9W8P8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.