Questions tagged [angularjs-ng-resource]

The ngResource module is part of AngularJS and provides interaction support with RESTful services via the $resource service.

The ngResource module is part of AngularJS and provides interaction support with RESTful services via the $resource service.

Link to the API: https://docs.angularjs.org/api/ngResource

57 questions
3
votes
0 answers

Angularjs 1.7.9 - Possibly unhandled rejection

I constantly have this error Possibly unhandled rejection even when using $promise.then(success, err) or $promise.then(success).catch(err) What should I do to fix this error. Thanks this is the code this.User =…
3
votes
1 answer

Angular Resource Save Promise

I am trying to resolve a promise from angular $resource save. The docs specify that I can access the raw $http promise via the $promise property on the object returned as follows: var User = $resource('/user/:userId',…
2
votes
0 answers

How to pass in API subdomain to ngResource?

I'm using ngResource to consume a RESTful API, and have implemented the following service: app.factory('User', function($resource) { return $resource('/api/users/:id', { id: '@id' }); }); I would like to pass in a subdomain to it. Is there a way…
rebagliatte
  • 2,110
  • 1
  • 20
  • 25
2
votes
1 answer

Angularjs: Store $resource data in service to share across controllers

Short question: Is it possible to store the data from $resource in a service, so as to query once and use it in different controllers? I tried query().$promise.then, but still resource is returning an empty reference. What is the correct syntax to…
2
votes
1 answer

Get the response using ngResource

I created a factory where I have a method forming the object 'create' and the controller causes through submit REST command. Now I would like a response data because the console I can see that the request was successful. How to do it ? How to get…
user4406224
1
vote
1 answer

Return value from service once $resource promise is resolved

I have such working code: Service (factory?): myApp.factory('MyService', ['$q','$resource', 'MyResource', function ($q, $resource, MyResource) { return { getRoles: function () { return MyResource.getRoles();…
1
vote
0 answers

Angular ngResource returns char[] instead of JSON object

I am new to angular and trying to use $resource to send a POST and receive a result.The post goes ok, but rather than a JSON result, I get a char[] of the JSON result.I really will appreciate help Here is my codes: controller (function (appTI) { var…
Caesar
  • 59
  • 1
  • 10
1
vote
2 answers

ngResource is failing to load

I'm using ngResource with http to call the rest webservice that I made for the crud and I get this error…
oui oui
  • 27
  • 7
1
vote
1 answer

How to manipulate data from ngResource query() before returning it?

I'm trying to comprehend how can I modify data that $resource.query() returns which - as it turned out - is not really Promise from $q but an empty object/array to be filled when async call is done. I defined a service where I'd like to modify data…
1
vote
1 answer

How to pass a controller variable as a parameter for a AngularJS $resource request?

I am new in angularjs and I think this should be a simple thing to do but I could not accomplish it. Basically what I need is to get a variable from an service and pass it as a parameter in a GET request. For this I am using the ngResource…
1
vote
1 answer

AngularJS wait for $resource response to set value

Here is my problem: I have a service created with $resource and a controller; the controller calls the service, and I try to set a value after the response (actually the error) was received. The problem is: I'm trying to set that value outside of…
1
vote
2 answers

global error handling for ngResource

I am searching a way to handle network related errors for my all ngResource based services in one place. From this answer I know that I can define a custom interceptor for all actions in a single resource. Is it possible to modify default actions…
Lukasz
  • 185
  • 1
  • 10
1
vote
0 answers

using ngResource to connect prestashop

I want to create a service to connect to the prestashop API and use it. The prestashop API is like this: http://APIKEY@domain/api/module How can I use ngResource to support APIKEY params in the path and also allow cross-origins to connect another…
1
vote
0 answers

AngularJ/ng-resource + Nodejs/express.js querystring compatibility

I'm working on a SPA built with AngularJS+ng-resource that works with RestAPI built with Node.js+Express.js+Sequelize. The problem: express.js accepts and parse queryString as Json Object. Ng-resource produces a bad queryString if you use this json…
1
vote
1 answer

Angular ngresource update method not a function

I am using the MEAN Stack. I am trying to add a PUT request into my $ngResource and I get an error: TypeError: conService.update is not a function at m.$scope.joinCon (http://localhost:3000/javascripts/chirpApp-ngresource.js:217:14) at…
Trewaters
  • 949
  • 3
  • 13
  • 23
1
2 3 4