I've tried three kind of REST servers with bAngularJS $http :
 - NodeJS / mongodb-rest http://localhost:3000/test/users :
      http://localhost:3000/test/users
      [
        {
          "name": "Yvonec",
          "_id": "52c7d8e20dd0bc6d1c000001"
        },
        {
          "name": "Lilwenn",
          "_id": "52c7d8e20dd0bc6d1c000002"
        },
        {
          "_id": "52cb22116d3c20e905f23239",
          "name": "Toto"
        }
      ]

- Ruby   / DrowsyDromedary  http://localhost:9292/test/users :
[{"name":"Yvonec","_id":{"$oid": 
"52c7d8e20dd0bc6d1c000001"}},{"name":"Lilwenn","_id":{"$oid": 
"52c7d8e20dd0bc6d1c000002"}},{"_id":{"$oid": 
"52cb22116d3c20e905f23239"},"name":"Toto"}]

- Python / sleepy.mongoose http://localhost:27080/test/users/_find
{"ok": 1, "results": [{"_id": {"$oid": "52c7d8e20dd0bc6d1c000001"}, "name": 
"Yvonec"}, {"_id": {"$oid": "52c7d8e20dd0bc6d1c000002"}, "name": 
"Lilwenn"}, {"_id": {"$oid": "52cb22116d3c20e905f23239"}, "name": "Toto"}], 
"id": 0}

Despite different formats, the results, in a browser, are correct.

However, using AngularJS (I'm a newbie here) i get success only with Ruby 
DrowsyDromedary server.

here is my js code :

    var URL='http://localhost:3000/test/users';        // NodeJS / 
mongodb-rest
    var URL='http://localhost:9292/test/users';        // Ruby   / 
DrowsyDromedary
    //var URL='http://localhost:27080/test/users/_find'; // Python / 
sleepy.mongoose
    function RESTClient($scope, $http) {
      $scope.users=[];
      $http.get(URL).
        success(function(data, status) {
          console.log("success => typeof  data = "+typeof data);
          console.log("success =>   data = "+data);
          console.log("success => status = "+status);
          $scope.users = data; // get here with Ruby   / DrowsyDromedary 
server ONLY...
         })
        .error(function(data, status){
          console.log("error => typeof  data = "+typeof data);
          console.log("error =>   data = "+data);
          console.log("error => status = "+status);
        });
    }

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to