The AngularJS ngResource module provides interaction support with RESTful services via the $resource service.
Questions tagged [ngresource]
525 questions
                    
                    134
                    
            votes
                
                5 answers
            
        What is the advantage of using Restangular over ngResource?
ngResource already seems really simple to implement things with...
What are the Advantages / Disadvantages of using Restangular over ngResource?
1.1.3 $resource will return promises and can be implimented using latest PR commit.  Will future support…
         
    
    
        Dan Kanze
        
- 18,485
- 28
- 81
- 134
                    32
                    
            votes
                
                3 answers
            
        Angular2 module similar to ngResource / $resource
When I take a look into Angular2 docs I can't find any REST helper module like Angular1's ngResource. I find it very useful in Angular1, so I would like to have something similar in Angular2, but the only thing I can find is 'angular2/http' which…
         
    
    
        smnbbrv
        
- 23,502
- 9
- 78
- 109
                    24
                    
            votes
                
                2 answers
            
        AngularJS $resource makes HTTP OPTIONS request instead of HTTP POST for $save method
I'm in the process of writing a simple library application to get ready for a larger project with AngularJS. After reading a lot online about using $resource to interact with a RESTful API, I decided that it would probably offer some time-saving and…
         
    
    
        Tom P.
        
- 712
- 1
- 5
- 17
                    18
                    
            votes
                
                1 answer
            
        How to pass headers on the fly to $resource for angularjs
Right now, the only way that I know for setting tokens in headers dynamically for an angularjs call is via $http like so:
return $http.get({
  url: 'https://my.backend.com/api/jokes',
  params: {
    'jokeId': '5',
  },
  headers: {
   …
         
    
    
        pulkitsinghal
        
- 3,855
- 13
- 45
- 84
                    18
                    
            votes
                
                1 answer
            
        Error in resource configuration. Expected response to contain an object but got an array
I have an angular response that expects an array and the service call passes an array(can see it in network tab of chrome dev tools).
but I'm getting the following error in chrome console.
Error in resource configuration. Expected response to…
         
    
    
        helloworld
        
- 965
- 5
- 14
- 34
                    15
                    
            votes
                
                2 answers
            
        Creating new Angular $resource with default values?
It is possible to define an Angular $resource that has always the same default values on creation with new()?
For example if I have the following resource definition: 
var Drawer = $resource('/drawer/:drawerId', { drawerId: '@id'});
And the Drawer…
         
    
    
        John Bernardsson
        
- 1,751
- 1
- 17
- 19
                    14
                    
            votes
                
                2 answers
            
        Uncaught object error on Chrome. Angularjs + ngResource
While using debug on Chrome, it keeps showing this error: uncaught object, on angular.js:36.
What am I doing wrong? :/
Thanks for any help :)
Module and Resource objects (services.js)
var services = angular.module('ngdemo.services',…
         
    
    
        Italosnt
        
- 161
- 1
- 2
- 9
                    10
                    
            votes
                
                2 answers
            
        How to properly convert controller and service from AngularJS to using ng-resource
I only started learning ng-resource recently. I'm wondering if I am on the right track when it comes to converting my regular AngularJS application to one which uses ng-resource.
This is my old home.js controller (without using…
         
    
    
        SilentDev
        
- 20,997
- 28
- 111
- 214
                    10
                    
            votes
                
                3 answers
            
        Multiple parameters in AngularJS $resource GET
'use strict';
angular.module('rmaServices', ['ngResource'])
    .factory('rmaService', ['$resource',
        function ($resource) {
            return $resource(
                   '/RMAServerMav/webresources/com.pako.entity.rma/:id',
             …
         
    
    
        Sami
        
- 2,311
- 13
- 46
- 80
                    9
                    
            votes
                
                4 answers
            
        How to save rows in a grid that I made a change to
I used ng-resource to get data from my server and then place the data into a table grid like this:
      
        
            
            
                
                    
    
    
    
    
                
            
        
    
                    
           …
        user1943020
                    9
                    
            votes
                
                3 answers
            
        angularjs $resource class-level callbacks, or post-processing
I have a $resource whose API will always return some data that needs to be cleaned up before going into the presentation layer. Specifically, it's .NET returning Date objects in the lovely '/Date(...)/' format.
I don't want to have to write a…
         
    
    
        c0bra
        
- 2,982
- 23
- 34
                    8
                    
            votes
                
                1 answer
            
        Custom response's headers are missing from transformResponse headers argument ($resource)
I've defined an $resource to an API endpoint that returns a response containing several headers but in the transformResponse config function most of headers are missing from the headersGetter function argument.
How can I fix it?
Response Header of…
         
    
    
        gudepier
        
- 3,362
- 6
- 22
- 26
                    8
                    
            votes
                
                1 answer
            
        Understanding angularJS $resource isArray property
i'm learning angular's $resource service and in the angular tutorial a custom action is added (query) that has its method set to 'get' and isArray is set to true
return $resource('phones/:phoneId.json', {}, {
      query: {method:'GET',…
         
    
    
        kevinius
        
- 4,232
- 7
- 48
- 79
                    8
                    
            votes
                
                1 answer
            
        AngularJS custom model objects with methods?
When you have a JSON $resource how can you cast the resulting objects into more specific objects once obtained?
For example, right now they come back as an Array of Objects, but I want them to come back as an Array of "Appointment" objects, so that…
         
    
    
        jr.
        
- 4,503
- 7
- 44
- 62
                    7
                    
            votes
                
                2 answers
            
        Sending id to DELETE API using $resource in angularJS
I have this delete method with $resource for my angularJS service,
return $resource(apiUrl, {}, {
    delete: {
        url: apiUrl+ ":itemId",
        params: { itemId: "@itemId" },
        method: 'DELETE'
    }
});
However while trying to call…
         
    
    
        TBA
        
- 1,077
- 5
- 41
- 80