Questions tagged [angular-resource]

An angularjs factory which creates a resource object that lets you interact with RESTful server-side data sources.

The returned resource object has action methods which provide high-level behaviors without the need to interact with the low level $http service.

Requires the ngResource module to be installed.

By default, trailing slashes will be stripped from the calculated URLs, which can pose problems with server backends that do not expect that behavior. This can be disabled by configuring the $resourceProvider like this:

app.config(['$resourceProvider', function($resourceProvider) {
  // Don't strip trailing slashes from calculated URLs
  $resourceProvider.defaults.stripTrailingSlashes = false;
}]);

$resource docs

756 questions
-1
votes
1 answer

Displaying created record Id in controller of Angularjs

Hi I am writing certain values to database which returns the id of saved record. My factory has following return { postNewR: $resource('/api/newRec', {}, {create: {method: 'POST'}}) } In my controller I have…
J. Davidson
  • 3,297
  • 13
  • 54
  • 102
-1
votes
1 answer

Chained promises in AngularJS

I think that I am an idiot. What is happening here?? Why there is no i:0 or i:1, just only the last one? It shows that it loops everything and just after looping it tries to save and it is saving the same last object many time and after that I'll…
Sami
  • 2,311
  • 13
  • 46
  • 80
-1
votes
1 answer

How to tell what are the mandatory parameters when calling an AngularJS $resource

I know that is it possible to create custom methods using the AngularJs $resource, but I would like to know if it is possible to tell the person that is using the resource what parameter they should provide when calling it. I am not talking about…
RPDeshaies
  • 1,826
  • 1
  • 24
  • 29
-2
votes
2 answers

How to convert string of objects to JSON object in angular transformRequest

So I'm receiving this string: {"id":"0-worfebvjyyvqjjor","size":17,"price":921,"face":"( .-.)","date":"Mon Jan 04 2016 22:55:30 GMT+0000 (GMT Standard Time)"} {"id":"1-ifma3yxxccgzaor","size":19,"price":98,"face":"( .o.)","date":"Fri Jan 08 2016…
Frederico Jesus
  • 649
  • 6
  • 14
-2
votes
1 answer

AngularJS check if promise is empty or not

Hi I have this code for the purpose of checking if there are users in the database, if it finds shows a list of users on a view, otherwise shows a view with form of user creation, but didn't work the check expression what I'm doing wrong users =…
efirvida
  • 4,592
  • 3
  • 42
  • 68
-2
votes
4 answers

How to send objects with arrays using angular resource?

I have a product object with a property called category_ids that is an array of ids. I've added an $update method to my resource factory so I can send a PUT request. When I PUT, the server receives data that looks like: id: 1, description: 'Yada…
Nathan
  • 7,627
  • 11
  • 46
  • 80
1 2 3
50
51