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

AngularJS, ngResource - Unexpected token Error

EDIT: I got the mistake but no solution. It seems that 'isEditable', 'isOnline' and 'isRecycled' are not sent as booleans but as strings. Therefore my Validaton did not pass and the Error-Response was not valid JSON. But why does the .save() call…
0
votes
1 answer

error when reading json file using angular resource

I'm trying to use angular ngResource module to fetch data from json file but I get an error 404 on the console - the URL is being concatenated with code following the call to get function. Here is the error: localhost…
Erab BO
  • 776
  • 4
  • 11
  • 24
0
votes
1 answer

Understanding the $resource factory and the @ prefix

Given the following service: vdgServices.factory('UserService', ['$resource', function($resource) { return $resource('api/users/:id', {}, { doGet: { method: 'GET', params: { id: '@userId' } }, …
sp00m
  • 47,968
  • 31
  • 142
  • 252
0
votes
1 answer

Curious case of webapi put request (FromBody model ) not getting populated with angular $resource

I have a Webapi controller as below . Pretty crude though . public async Task Put(string id, [FromBody]Students studentToupdate) { if (!ModelState.IsValid) { return…
Joy
  • 6,438
  • 8
  • 44
  • 75
0
votes
2 answers

AngularJS $resource Error Handing with Callback

I have a factory that has multiple services for querying a custom API I built. The callbacks all work, but I'm wondering how I can have any error handling while fetching. .factory('customApiService', function ($resource) { return { …
Cory Shaw
  • 1,130
  • 10
  • 16
0
votes
0 answers

JSONP in AngularJS resourse - No 'Access-Control-Allow-Origin' header is present on the requested resource

I'm trying to rewrite my code using factory: My current code: $http({ method: "JSONP", url: url}).success(function(data){ $scope.albums = data.entries; }); is ok But my new code: app.factory('Album', ['$resource', function ($resource) { return…
proton
  • 193
  • 2
  • 13
0
votes
1 answer

Unnormalized data via resource in AngularJS

I am working on a WebApp using AngularJS. I have two main models, journeys and locations. Each journey has a start and an end destination. On the server side I only handle normalized data, i.e., journeys and locations are stored in separate…
Boris Lau
  • 55
  • 1
  • 9
0
votes
1 answer

Scope not updated outside resource callback function

I have a factory in AngularJS called WebService which returns a $resource object. angular.module('cstarsServices') .factory('WebService', function ($resource) { return $resource("some_url_here/:op1/:op2/:op3/:op4", {op1:…
kjakeb
  • 6,810
  • 5
  • 20
  • 34
0
votes
1 answer

AngularJS ngResource not working

I have the following problem: I am using ui-router to display a ng-grid on a page. But the $resource is not changing the parameter from the url when sending to server (e.g. http://bcunix.test:8080/MYAPP/eq/:Id). The :Id is not changed, and I get Bad…
AdiP
  • 179
  • 1
  • 4
0
votes
4 answers

JSON.parse() fails in AngularJS TransformResponse

I am trying to GET from Wattpad.com's API level 3, http://www.wattpad.com/api/v3/stories/, using Service angular.module('myApp') .service('WattpadService', function WattpadService($resource) { var resource =…
Christine
  • 512
  • 2
  • 9
  • 21
0
votes
1 answer

AngularJS query works with http, but not work with resource

I try to use many answers about that but they did not work. I am am using an api to get json data with AngularJS. I can get data with $http and bind it to front end. But i can not get same data with $resource. When i try to get data with ngResource…
Ras
  • 89
  • 1
  • 9
0
votes
0 answers

Can not fetch value from REST service in AngularJS

I'm trying fetch data by calling Java REST service from AngularJS web portal. I'm using ngResource. Call From Angular Service : BankingModule.factory('UserFactory', function ($resource) { return…
0
votes
1 answer

Remove body from PUT request in ngResource query

I'm should to send a PUT query for some url. But rest reject my query if it contains any body(JSON, like {"id": 1}). When I'm use ngResource instead of $http, query already contains a body. How can I remove it? Sample of expected…
S Panfilov
  • 16,641
  • 17
  • 74
  • 96
0
votes
2 answers

Angular ng-resource POST sending query params not JSON

I'm trying to get my first ng-resource example working. The problem is it's sending the data as query params rather than JSON. I have this service for my REST resource. REST_URL_PREFIX is just a constant. angular.module('myApp') .service('Test',…
Ben Thurley
  • 6,943
  • 4
  • 31
  • 54
0
votes
1 answer

Order of executing requests with AngularJS's ng-resource?

books_ctrl.js.coffee myApp.controller "BooksCtrl", ($scope, Book) -> $scope.getBooks = () -> $scope.books = Book.query() Part A: Initial Code: $scope.delete = (book) -> book.$delete() $scope.getBooks() Part A: Solution by…
soosap
  • 1,365
  • 2
  • 14
  • 30