Questions tagged [ngresource]

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

Resources

Tags

525 questions
0
votes
1 answer

How to get JSON out of Angular $resource

How do i get the get JSON data out of a $resource? Currently all return values out of User.query and User.$save() are factory objects. I would like to be able to keep $scope.users as raw JSON so I can modify it and post the data to another URL. …
mphuie
  • 970
  • 1
  • 9
  • 17
0
votes
1 answer

How to use ngResource inside a bind callback function?

I have made a directive which bind a click event with the element. On click I want to use a factory which makes an ajax call. How do I achieve this ? My code looks like this angular.module('user') .directive('activityFeed',…
aditya
  • 996
  • 2
  • 12
  • 25
0
votes
1 answer

AngularJS ngResource Send data to server with JSON and get response

In my angular JS app i need to send data to server: "profile":"OLTP", "security":"rsh", "availability":"4", "performance": { "TRANSACTION_PER_SEC":1000, "RESPONSE_TIME":200, "CONCURRENT_CONNECTION_COUNT":500, "STORAGE_SIZE":200, …
Oshenko
  • 17
  • 4
0
votes
2 answers

Is it possible for ngResource to be called synchronously?

I currently have a factory which I'm using to retrieve a config file. m.factory('clientConfig', function($resource) { var r; r = $resource('assets/config.json', {}, { query: { method: 'GET' }, isArray: false …
Diskdrive
  • 18,107
  • 27
  • 101
  • 167
0
votes
2 answers

Angular resource (ngResource) won't make the AJAX call when called inside a function

I'm trying to make an AJAX call with ngResource, In the code below 'a' and 'b' both print, but the AJAX call from Table.import() does not get made. If I move the AJAX call outside of onFileRead, then it works. What could be the problem? var…
mmattax
  • 27,172
  • 41
  • 116
  • 149
-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
2 answers

How to convert REST call from $http to $resource?

How can I convert this REST call in angularJS from $http to $resource? $http.get('https://url?&q={"last-name":"Harris"}') .success(function (restData) { $rootScope.resp = restData; });
Lee DaBord
  • 11
  • 2
-1
votes
1 answer

Angularjs ngresources cannot get the url

i have the following url "http://localhost:3000/api/user/" and is work fine in the browser, but when i put it in my ionic service code return $resource('/api/user/'); is return data : cannot Get /api/user\n and when i change the url to url…
Ebrahim Ze
  • 29
  • 1
  • 11
-1
votes
2 answers

AngularJS: ngResource 500 internal server error

I have a problem in getting list of users using $resource. I am making a webservice call using $resource to get list of users. It works most of the time, but when ever the response takes some time I am getting 500 internal server error. The code I…
Raja
  • 1
-1
votes
2 answers

Accessing specific json data in AngularJS

I have a json file that includes article information where each article has an id. This is how it is formatted: [{"title":"ISIS No. 2 killed in US special ops raid", "id":"14589192090024090", "agency":"foxnews", "text":"Article text goes…
Jess Anastasio
  • 687
  • 5
  • 18
  • 26
-1
votes
1 answer

Angular ngResource "CartResource.get is not a function!"

In my app, I define a cart resource .factory('CartResource', function ($resource) { return $resource('/api/Cart/:id'); }); on the module. In my logincontroller, (function () { "use strict"; angular.module('ShoppingCart') …
Alex Kibler
  • 4,674
  • 9
  • 44
  • 74
-1
votes
2 answers

$ng-resource doesn't work?

I'm new to AngularJS, I would like to update my data.json but that I don't know where my file users.json should be and I have this error: Error: $injector:modulerr http://errors.angularjs.org/1.3.14/$injector/modulerr?p0 Heres my code…
carine
  • 51
  • 1
  • 8
-2
votes
1 answer

How to change request method in ngResource?

How modify save method for put, if id specified and post if not? I mean: Posts.save({id: 1, content: "..."}) // PUT /posts/1 Posts.save({content: "..."}) // POST /posts
nkt
  • 181
  • 1
  • 9
1 2 3
34
35