Le mardi 7 janvier 2014 11:47:12 UTC+1, Sander Elias a écrit :
>
> Hi Yvon,
>
> I hear good things about restangular<https://github.com/mgonto/restangular>.
> Never used it, as I write my own backend's.
> If you want to stay within angular, have a look at the
> $resource<http://docs.angularjs.org/api/ngResource.$resource> which
> is a wrapper on $http that handles REST.
>
> If you need more information don't hesitate to ask!
>
> Regards
> Sander Elias
>
Fine thanks, i didn't mention I've also given a try using $resource and
restangular, for the time being this is worst..
angular.module('RESTTestApp', ['ngResource']);
var
URL='http://localhost:3000/test/users/52c7d8e20dd0bc6d1c000002'; //
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, $resource) {
$scope.URL=URL;
$scope.data = $resource(URL,
{ callback:'JSON_CALLBACK'},
{get:{method:'JSONP'}});
$scope.users = $scope.data.get();
}
for restangular, I'm not even ok reading the doc ))
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
// Add Restangular as a dependency to your app
angular.module('your-app', ['restangular']);
// Inject Restangular into your controller
angular.module('your-app').controller('MainCtrl', function($scope,
Restangular) {
$scope.URL=URL;
var users = Restangular.all(URL);
users.getList().then(function(users) {
console.log("users = "+users);
$scope.allUsers =users;
$scope.user= $scope.allUsers[0];
});
// ...
});
here i don't even get into ".then(function(users)"...
In fact all of those is to replace, eventually, my own Secure Web Socket
server (written in js / NodeJS) working with mongodb (native).
--
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.