The AngularJS ngResource module provides interaction support with RESTful services via the $resource service.
Questions tagged [ngresource]
525 questions
3
votes
2 answers
Maintaining a resource collection with ngResource, socket.io and $q
I am trying to create an AngularJS factory that maintains a collection of resources automatically by retrieving the initial items from the API and then listening for socket updates to keep the collection…

mz3
- 1,314
- 11
- 27
3
votes
0 answers
AngularJS + Jasmine + JWT Token in $http requests
I'm trying to build some test with an API that works with JWT authentication tokens, but the factories that I'm trying to test use $resouce, which needs to be configured with JWT Token. In the app I configure it in the .config, but in Jasmine I have…

mariowise
- 2,167
- 2
- 21
- 34
3
votes
3 answers
How to pass dynamic param in angular $resource
I want to pass dynamic value of default param in $resource. Please look into the Plunker. Here when I had passed default param in factory as
app.factory('myFactory', ["$resource", function($resource) {
return $resource('http://google.com',…

Amit Mourya
- 538
- 1
- 7
- 18
3
votes
0 answers
how to achieve pagination with ngTable ngResource and oData
is there any good example of server side pagination using ngTable and ngResource.
i am loading a table like this
function getStoreCommands() {
$scope.data = storeCommandResource.query();
return…

Raas Masood
- 1,475
- 3
- 23
- 61
3
votes
3 answers
how to send x-www-form-urlencoded data using ngResource module with angular?
everything lives in the title.
when producing a resource in angular :
myModule.factory('MyResource', ['$resource', function ($resource) {
return $resource('api/MyResource/:id');
}]);
and using in a controller :
MyResource.save({att: att,…

vdegenne
- 12,272
- 14
- 80
- 106
3
votes
2 answers
angularjs $resource and one-to-many relationship
what is the right way to use ngResource for a complex data model?
There are countless one-table examples out there, but little to nothing covering 1:n and m:n relationships.
Assuming a simple 'parent' 1->n 'child' relationship, and the entry point…

szeta
- 589
- 1
- 5
- 21
3
votes
3 answers
chaining ngResource $promise success and errors
I'd like to know if it's possible to handle the $promise returned by ngResource on multiple levels so that the code is DRY
here is a simple example
aService = function(aResource) {
var error, success;
success = function(response) {
…
user4526623
3
votes
1 answer
Angular NgRessource with paginated results from django rest framework
My api basically returns something like this:
GET /api/projects/
{
"count": 26,
"next": "http://127.0.0.1:8000/api/projects/?page=2",
"previous": null,
"results": [
{
"id": 21,
"name": "Project A",
...
},
{
…

Alex Grs
- 3,231
- 5
- 39
- 58
3
votes
3 answers
angular ngResource pass additional arguments to the url
I have a project resource that consists of multiple task resource (similar to Facebook post and comments relationship)
When I update a project, I want to use url /project/[project id]. and when I update a task, I want to use url /project/[project…
user626776
3
votes
2 answers
angular resource clears object data after post
my angular app clears data after post.
Here is the snippet from controller:
$scope.saveDevice = function() {
var deviceId = $scope.device.id;
if (deviceId) {
$scope.device.$update(function(result) {
…

VsMaX
- 1,685
- 2
- 16
- 28
3
votes
1 answer
handle error callback on save() method $ngResource
I need to handle error callback of an update operation, for this i'm using method save() like this:
$scope.save = function (params) {
MigParams.save(params);
};
Migparams service look like this:
angular.module('monitor').
…

Aramillo
- 3,176
- 3
- 24
- 49
3
votes
2 answers
How do you send a POST request for logging in, with Angular's $resource?
I thought this would be simple to do but it terribly confusing.
I want to set my Angular login form to allow my users to login. On the login form, I want to take the input and send it as a POST request to my server for verification.
However, I…

CodyBugstein
- 21,984
- 61
- 207
- 363
3
votes
1 answer
Angular $http doesn't turn all response headers
I would like to get the 'X-Total-Count' response header of a RESTful API. While trying to get the header in the query callback function of my ngResource 'User', it seems that $http ignores a lot of the reponse headers.
These are the response headers…

MonsJovis
- 186
- 1
- 8
3
votes
1 answer
Appending Param to AngularJS REST Queries
I'm using AngularJS with UI-Router and am attempting to attach a query parameter to a url on all http requests across my site.
I have an OAuth system on the backend and was previously applying Authorization headers to all requests, however to…

Fritz
- 41
- 1
3
votes
1 answer
AngularJS - Mapping REST search endpoint onto $resource
ng-resource returns an object with the following default resource actions
{ 'get': {method:'GET'},
'save': {method:'POST'},
'query': {method:'GET', isArray:true},
'remove': {method:'DELETE'},
'delete': {method:'DELETE'}…

JM.
- 678
- 12
- 23