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
0
votes
2 answers

AngularJS service with express error: [$resource:badcfg] object

I'm using external mongodb and wrote a node/express server for fetching the data on my localhost. I query localhost like this: http://localhost:8888/api/bonsais And I'm getting the correct results from my mongodb collection @…
Martijn.Veenstra
  • 121
  • 1
  • 2
  • 7
0
votes
1 answer

Angular JS, scope updates in Async callback

I've got a series of 2 AJAX requests, with the latter depending on the results of the first. I've put them into the promise of the first returned object. ie. var productResource = $resource('http://urlhere'); $scope.product =…
Ren
  • 3,395
  • 2
  • 27
  • 46
0
votes
1 answer

Special characters in params in a resource

I would like to send a REST get with a resource and passing a query with special characters inside. I don't have the choice and need to use it. For example : var query =…
BastienSander
  • 1,718
  • 4
  • 24
  • 50
0
votes
1 answer

How to show a div when a resource complete get data

I have a factory which call HomeNews and i want to make a preload div when the $resource is still process . This is My ,Service File (function() { var newsServices; newsServices = angular.module("newsServices", ["ngResource"]); …
user3395037
  • 55
  • 2
  • 9
0
votes
1 answer

Update scoped variable based on Angular $resource

I have an Angular app communicating with an external API. I'm able to generate the initial view from an Angular $resource call. My problem is that I have a form that runs a function on ng-click. That function then queries the API again and is…
wgp
  • 1,147
  • 15
  • 15
0
votes
1 answer

angular resource passing unwanted parameters

I am trying to setup a server side authentication service using rails like this : Javascript: angular.module('myApp',['ngResource']) .factory("Session",['$resource',function($resource){ return $resource('/sessions',{}, { create: {method:…
goutham
  • 240
  • 2
  • 12
0
votes
3 answers

How to use angular resource with rails API

I want to use angular resource to interact with my rails backend, the build-in $resource service is not fully compatible with rails API, like PUT is not support by default, I have to add custom action "update" with PUT method. This problem with this…
fuyi
  • 2,573
  • 4
  • 23
  • 46
0
votes
2 answers

angular-resource not being properly injected with AMD

I fail to make angular.resource.js work with angular.js. Angular is loaded but it seems angular.resource is not. index.html