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

Not the typical "TypeError: Object # has no method 'push'" issue

I've scoured all the other answers I could find here on SO and I'm still hitting a weird issue here. It's the same old "TypeError: Object # has no method 'push'" error that many of you have most likely come across before, where you are expecting an…
boardlemur
  • 2,861
  • 1
  • 18
  • 24
2
votes
1 answer

How to control the isArray value from the calling function? (modify $resource params)

I was wondering how can I set the isArray parameter in the resource, because sometimes I want it to be true and sometimes false Here is my resource factory code dummyServices.factory('Dummy', ['$resource', function ($resource) { return…
Daniel
  • 36,833
  • 10
  • 119
  • 200
2
votes
0 answers

Angularjs. $resource change encoding to ISO-8859-1, but server sent in utf-8

i have a trouble) From angularjs i send data into my server using next service app.factory("SpeakerEditService", function ($resource) { return $resource('url', { speakerId: '@id', firstName: "@firstName", …
Svetlana Ivanova
  • 155
  • 2
  • 11
2
votes
1 answer

Angular scopes and losing binding

I haven't been able to find anywhere else that really helps me understand my Angular problem here but I suspect it has something to do with inheritance that I haven't completely grasped yet. I'm doing an ng-repeat of a custom directive and seeing…
2
votes
0 answers

What is the correct way of handling angular resource 1.2.x get queries?

I am currently working on implementing a REST API with Angular resource 1.2.x. I just came across several hints that with the 1.2.x release, angular-resource broke some existing patterns. My question is now, how to handle the following scenario with…
rit
  • 2,308
  • 3
  • 19
  • 27
2
votes
3 answers

AngularJS $resource not sending custom headers

I'm using angular and angular-resource version 1.1.5 and I'm using a $resource to make a request to a REST service. But it seems like the custom headers is not appended to the request. My definition is as below. Is there anything I did…
user2961105
  • 23
  • 1
  • 1
  • 4
2
votes
1 answer

Angular $resource setup : Communicating between factory services

I am trying to implement pagination for my Laravel 4 + angular.js 1.0.7 application by reading this article. My code looks, var app = angular.module('cmsPlus', ['ngResource']); app.service( 'Post', [ '$resource', function( $resource ) { return…
2
votes
2 answers

Kendo-UI datastore leveraging Angular $resource

I am attempting to implement a abstraction over a RESTful back-end for my persistence layer and have ran into something I find a little confusing. I am using the angular framework and more specifically the ngResource module to get access to the…
techie.brandon
  • 1,638
  • 2
  • 18
  • 27
2
votes
1 answer

AngujarJS server-side pagination grand total items using $resource

I'm trying to implement server-side pagination on an AngujarJS app but haven't figured out how to get the grand total (not the per-request total) items in a given JSON response without having to do an additional request: $scope.books =…
Nano Taboada
  • 4,148
  • 11
  • 61
  • 89
2
votes
2 answers

Angular $resource and use of Interceptor to check response/error/callback

Last few days I am working to invoke REST services and track the response, error, callback etc. I have gone through most of the posting however due to my limited understanding on Angular seems like I am not able to understand it. Following is my…
joy
  • 3,669
  • 7
  • 38
  • 73
2
votes
1 answer

angularjs integrate promise with resource

I have this resource: myModule.factory('MyResource', ['$resource', 'geoLocationService', function ($resource, geoLocationService ) { return $resource('/blabla', {}, { 'getData': { method: 'GET', params: { city:…
Naor
  • 23,465
  • 48
  • 152
  • 268
2
votes
3 answers

Possible to add custom properties on a $resource factory and propagate changes to those properties?

I have this code mostly working but I'm having difficultly seeing changes propagate from my User object within controllers. What I'm trying to do is build a single User service to manage all aspects of the current user on my site. Eg: User.login(),…
James Andres
  • 1,522
  • 14
  • 20
2
votes
1 answer

Dereferencing objects with angularJS' $resource

I'm new to AngularJS and I am currently building a webapp using a Django/Tastypie API. This webapp works with posts and an API call (GET) looks like : { title: "Bootstrap: wider input field - Stack Overflow", link:…
Maxime
  • 1,776
  • 1
  • 16
  • 29
2
votes
1 answer

Updating Angular originally loaded via JSONP

I have a resource that returns a JSONP payload: app.factory('JsonService', function($resource) { return $resource('//123.456.7.890\\:8888/user/:id/:model', {'page': ':page', 'limit' : ':limit', 'jsonp_callback' : 'JSON_CALLBACK'}, …
couzzi
  • 6,316
  • 3
  • 24
  • 40
1
vote
1 answer

How to pass array of locationId to service getLocationData?

How to pass array of locationId to service ? I have array of locations Id locationArr=[40871, 60009, 38149, 40868, 43240, 15299, 53897, 40976, 38151, 23183, 38152, 78579, 23180, 40977, 23176, 39565, 40884, 15298, 38147, 40966, 39669] Actually I…