The AngularJS ngResource module provides interaction support with RESTful services via the $resource service.
Questions tagged [ngresource]
525 questions
4
votes
1 answer
Downloading an XML file using angularJs resource
I'm trying to use angularJs resource to download a file from a server but it dosen't work.
my code is as following:
// service
angular.module("someModule")
.factory('generate', ['$resource', '$rootScope', function ($resource, $rootScope) {
return…

Rivi
- 791
- 3
- 15
- 23
4
votes
1 answer
How to properly handle server side errors?
I'm developing web app with angular.js, I'm currently a little confused about what's the proper way to handle errors. In my app, I have used ngResource to call rest API of server. So I'll have a lot of ngResource api calls.
e.g. user resource,…

Aaron Shen
- 8,124
- 10
- 44
- 86
4
votes
3 answers
angular-resource.js encodeUriSegment Issue
I have an issue querying restful resources when the resource uri has several subpaths :
Example :
.factory('SomeFactory', function ($resource) {
return $resource('/path/subPath/otherSubPath/:id', {}, {
show: { method: 'GET', params: { id: '@id' }…

user3108667
- 41
- 1
- 3
4
votes
1 answer
Links (relations) to REST resources in AngularJS
I have a REST API, which returns User object, where its roles are specified via link to another object. So at localhost/project/api/users/27/ is JSON object:
{
"id": 42,
"name": "John",
"prijmeni": "Doe",
"login": "johndoe",
…

PhoenixS
- 1,016
- 1
- 9
- 23
4
votes
1 answer
ngResource appends POST parameters to url
I have an angular service that looks like this. Here i am making a POST request.
.factory("Apples", function ($resource, HOST) {
return $resource(
HOST + "/apples",
{},
{
…

lovesh
- 5,235
- 9
- 62
- 93
4
votes
2 answers
ngResource retrive unique ID from POST response after $save()
So I have a Resource defined as follows:
angular.module('questionService', ['ngResource'])
.factory('QuestionService', function($http, $resource) {
var QuestionService = $resource('/api/questions/:key', {}, {
query: {
…

grivescorbett
- 1,605
- 1
- 21
- 29
4
votes
1 answer
Seting enctype in AngularJS using ngResource
I'm using Angular's $resource to upload a file.
I need to set the encoding to mulipart/form-data, but I can't find anyway to set enctype in $resource.
Is that possible? In other words can $resource be used for file uploading or do I have to go…

user2782503
- 195
- 3
- 7
3
votes
1 answer
AngularJS calling a function once I've made an array
Background
I am making a angularJS app
I have an object called a Map. The Map has an array of Transforms IDs.
I need to fetch each transform in the Maps's array, then save these to an array of Transforms instead of an array of Transform IDs. So far,…

Rorschach
- 3,684
- 7
- 33
- 77
3
votes
1 answer
How to get boolean value using $resource of AngularJS and spring rest controller
Trying to send get boolean value from spring restcontroller using $resource service of angular js ,but getting nothing in response of $resource.get.Is there anythingextra i need to add on my client side or server side for getting boolean resource.…

Ashu Chauhan
- 79
- 3
- 12
3
votes
0 answers
How to fill data in ngTable using ngResource but search and sort without hitting API call?
I have a ngTable in which I want to fill the data when the controller is using ngResource to query the API call to get the response array.
Service (used same in both cases)
angular.module('core.template.block').
…

Harsh Vardhan Ladha
- 560
- 11
- 17
3
votes
1 answer
NgResource get call for requesting a map
i'm doing a small application and i realized yesterday about this thing i could not really understand.
I have my controller in Java listening for requests, it returns a Map with more than one value. But when I use ngResource in the controller, i'm…

txomin
- 177
- 2
- 3
- 15
3
votes
4 answers
Why do I have to use $promise with $resource?
Admittedly I am relatively new to Angular but I've come unstuck using ngResource for a REST call.
I followed a factory pattern which seems to be relatively common.
However my I only get access to the REST response by using a $promise.then. Which I…

Mark Chidlow
- 1,432
- 2
- 24
- 43
3
votes
0 answers
ODataAngularResources not parse OData 4 response
I try call OData v4 service with ODataAngularResources from typescript.
For test purpose I use Northwind Products OData Service
Here is code wich call service:
var results =…

rco
- 325
- 4
- 13
3
votes
2 answers
Chaining ngResource promises
Im using a REST Api that provides non-nested resources API. That leads to chained calls, that i want to make with promises. Im using the ngResource from angular, and im having problem chaining the calls. The idea is first to get the description of…

Sonne
- 691
- 1
- 6
- 20
3
votes
1 answer