Questions tagged [ngresource]

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

Resources

Tags

525 questions
0
votes
2 answers

Why my resources cannot be shown on my ng-model?

In my project, I use ngRoute to load the edit.php view into my index ng-view I dont know why the ngResource result not binding to my ng-model, here is my code: Javascript: var app = angular.module('smodule', ['ngRoute','ngResource']); /* Factory…
Katrin
  • 881
  • 1
  • 11
  • 23
0
votes
1 answer

Injector error with angular

I have the following error on my APP Error: [$injector:unpr] http://errors.angularjs.org/1.3.2/$injector/unpr?p0=ProductResourceProvider%20%3C-%20ProductResource My Scenario is as follows, a simple app that gets info from a webservice, but with ng…
Luis Valencia
  • 32,619
  • 93
  • 286
  • 506
0
votes
1 answer

Why is Angular $resource polluting my data?

I have an API returning the following response { "keyA": [1,2,5], "keyB": [3,6,4], "keyC": [3,2,1] } And I'm using a very simple service to access the API endpoint var $module = angular.module('mySimpleService',…
gargantuan
  • 8,888
  • 16
  • 67
  • 108
0
votes
1 answer

How do you search and return a specific index of a JSON resource in AngularJS?

I have a json file of events setup like this: { 2: { sched_conf_id: "38", title: "Coffee Break", }, 3: { sched_conf_id: "39", title: "registration", }, } I setup and angular factory like this: .factory('eventFactory',…
tbondt
  • 235
  • 1
  • 3
  • 10
0
votes
2 answers

Calling a function from a ngResource object not working

Lets say I have a factory called 'Stuff'. app.factory('Stuff', function($resource) { return $resource('api/v1/stuff/', {}, { getThings: { method: 'GET', params: {id: '@id'}, url: 'api/v1/things/:id', isArray: true …
magister94
  • 37
  • 6
0
votes
2 answers

ngResource: Promise not Resolved

Let's say a Service like this: .factory('GetPaths', function($resource) { return $resource('/paths/coord/:lat/:long', {lat: "@lat" }, {long: "@long" } , { get: {method: 'GET' , isArray: true }, } ); }) it…
Wheatley
  • 153
  • 1
  • 12
0
votes
1 answer

angular ui directive not binding to data loaded using $resource

I am trying to build an angularjs app that is loading data using $resource and provides pagination using pagination directive from angular ui bootstrap (http://angular-ui.github.io/bootstrap/). The pagination directive template html is rendered. It…
AunAun
  • 1,423
  • 2
  • 14
  • 25
0
votes
1 answer

ngResource custom headers when calling action

In ngResource action I can specify custom request headers. However I need to set the headers at the time of calling the resource action. The reason is I need paging and sorting data for the list query, and those need to be specified by custom…
redhead
  • 1,264
  • 1
  • 17
  • 32
0
votes
1 answer

How to apply transformation to all methods in Angular?

I want to apply the following transformation to all responses... I can do it one by one, but I have dozens.. so there must be a way to do it globally? I tried injecting it, but I get all sort of errors. transformResponse: function (data) { var…
smorhaim
  • 778
  • 1
  • 9
  • 24
0
votes
1 answer

Angular $resource: update self from get

Is there any built-in method or conventionally correct approach to this? I'm not asking about issuing an update, but rather, requesting one. I could query for it again, but the goal is that the object reference stay the same. The approach I've taken…
Semicolon
  • 6,793
  • 2
  • 30
  • 38
0
votes
1 answer

ngResource: Send data in URL instead of body

I'm trying to save a object with ngResource this way: var Tasks = $resource("http://example.com/task", { task: { id: '@id' } }, { 'save': { method: 'POST', params: { key: "abc" } } }); var…
fstr
  • 900
  • 3
  • 10
  • 31
0
votes
2 answers

Fetch .json with AngularJS $resource

So I have a web server that is handling my .json files. On the client side a have a simple service : var service = angular.module('services.service', ['ngResource']); service.factory('Service', ['$resource', function($resource){ return…
J.D.
  • 1,145
  • 2
  • 15
  • 29
0
votes
1 answer

Catch custom method PUT success with ng-resource

I have created a custom method update with method type put. I want to catch the success and fire some event there. Does anyone have fair idea how to do it? SERVICE (function () { 'use strict'; // this function is strict... angular …
Aditya Sethi
  • 10,486
  • 11
  • 26
  • 31
0
votes
1 answer

ngResource query returns strange objects

I am new to AngularJS and wanted to try out the $resource functionality. I have this code: .factory('GetTasksService', function($resource, BASE_URL) { return $resource(BASE_URL + 'api/tasks'); }) .controller('TasksCtrl', function…
Stefan
  • 1,590
  • 3
  • 18
  • 33
0
votes
1 answer

AngularJS $resource request, withCredentials with username and password

I'm trying to do a small application that should fetch json data from a homepage with basic http authentication. This is my service: app.factory('MySrvs', ['$resource', function ($resource) { return…
petur
  • 1,366
  • 3
  • 21
  • 42