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
1 answer

Angularjs calling instantiated resource methods with different url

I am trying to make resource calls to multiple endpoints with the same instantiated object. Methods that use a prototype resource method do change the endpoint, but the @id fails to extract. id is for sure a property on the object, if i do a regular…
0
votes
1 answer

Angular $filter not updating variable on array returned by $resource

Say I've got an Angular $resource that returns an array of entries that all have a name attribute. I would like to use $filter in Javascript (not using Angular's {{ blah | filter:filter }} syntax within the templates) to extract a subset of those…
fatuhoku
  • 4,815
  • 3
  • 30
  • 70
0
votes
1 answer

Submitting Form with Angularjs-rails throws error because of Angular Resource

When the page loads, the resource throws a 404 because the $resource is reading nil for :city_id. I am beginning with angularjs so any clarification is appreciated. The form entries fail to persist because this $resource is also used for PUT'ing…
Brian Petro
  • 1,577
  • 16
  • 32
-1
votes
1 answer

angular - After installing angular-resource and importing in @NgModule throws $$minErr undefined error

I am trying to use $resource object in my project. These are the steps I followed to install and import the package. Installed angular-resource using npm - npm install angular-resource Added ngResource as dependency in @NgModule -…
inspiringmyself
  • 590
  • 1
  • 11
  • 29
-1
votes
1 answer

AngularJS $resource query parameter with no value

From the AngularJS 1.6.x $resource documentation I know that I can pass in query name/value parameters using a JavaScript object. For example {foo: "bar"} for the path path/example will access a RESTful URL using something like…
Garret Wilson
  • 18,219
  • 30
  • 144
  • 272
-1
votes
2 answers

AngularJS Resource prevent duplicate requests

Having pagination on the page I've came across the issue, if the user clicks 3 times on the next page button it will send 3 requests to server. What would be the best solution to prevent it? I'm using angularJs 1.6.6 with ngResource
Den Rolya
  • 29
  • 5
-1
votes
1 answer

Receiving an $injector:unpr error when using ngResource

I am using ngResource and $resource instead of $http in my project. When I switched over to $resource, I received an $injector:unpr error when I ran the program. I checked to make sure that everything was spelled right. Additionally, I made sure…
-1
votes
2 answers

$resource object empty after get request

I want to save JSON-Data from my Rest-API in a $scope variable for further usage. The problem is when the Code is executed, i see in Firebug that i've got the JSON Data sucessfully, but the problem is, that i cant save it in my Scope variable and i…
member2
  • 155
  • 2
  • 16
-1
votes
1 answer

Angular $resource Get An Object with Number Keys

I'm using $resource to get a JSON object. Now it returned an object with number keys which was expected to be a JSON. My code: $resource('url', { 'param': 1 } }); var data = Session.get(function(e) {}); m {0: "[", 1: "{", 2: "s", 3:…
Hank
  • 331
  • 1
  • 13
-1
votes
2 answers

header is not working on angular $resource

In my angular app, I want to use angular custom header. I'm using the following code:: Angular Factory angular.module('app').factory('UserAPI', ['$resource', 'session', function($resource, session) { var mainUrl = 'http://localhost:8006/dev' +…
sabbir
  • 2,020
  • 3
  • 26
  • 48
-1
votes
1 answer

Angular $resource serialize functions too

Ik have a JavaScript object with lots of properties and calculated properties (which are functions), which I want to send to the server. Now when I call this method resource.save({ id: vm.allData.id }, vm.allData); (where vm.allData holds the…
Michel
  • 23,085
  • 46
  • 152
  • 242
-1
votes
1 answer

Why cant I make query call on Factory but I can on Controller? Angular

angular.module('app').factory('mvsomeManager', function ($q, $http, mvSomething){ return{ getsomedata:function(){ var data = mvSomething.query(); if(response){ dfd.resolve(response); …
user516883
  • 8,868
  • 23
  • 72
  • 114
-1
votes
1 answer

Calling function synchronizely in angularjs

I'm using pivot grid to show data from database ,So I get data by ajax ,the problem in synchronization ,pivot grid loaded before getting the data from database How can I retrieve data before execute pivot grid? function getData() to retrieve data…
Ali-Alrabi
  • 1,515
  • 6
  • 27
  • 60
-1
votes
1 answer

How to put object in query? Angularjs resource

For example I have something like this: { status: { text: "New", date: "22.06.12" } } Factory to interact with RESTfull lookes like (function(){ 'use strict'; angular.module('app') .factory('Orders', Orders); …
g_arc
  • 9
  • 4
-1
votes
1 answer

How to use nested resources in RESTful API?

I am new to REST API. Please help me to list all Albums, ordered by User name and if some User is clicked, show all albums of this user. This is the code I've written until now but it doesn't show me the right thing. These are…
Tina Mih
  • 3
  • 3
1 2 3
50
51