An angularjs factory which creates a resource object that lets you interact with RESTful server-side data sources.

learn more… | top users | synonyms

3
votes
0answers
161 views

Resource + Socket.io factory in Angular.JS

I'm writing a web application using Angular.JS, which uses a backend system written in Express and Socket.IO (a Node module). I've written a factory in Angular.JS for listing Elements: ...
3
votes
0answers
121 views

Error handling in an ngResource action

Is there any way to stop a transformResponse on an ngResource action from being called on a failed response. For example, the user resource here will look for data.user.firstname in the response even ...
2
votes
0answers
24 views

Angular $resource to not encode semicolons for matrix params?

I am having trouble as $resource encodes the semicolon so the server will not read the URL correctly. I would like to do something like this in my code: .factory('MyFactory', function($resource) { ...
2
votes
0answers
32 views

Angular $resource action return $resource of different class

So I have a services.js that looks something like this. .factory('User', function($resource) { return $resource('/api/users/:id/', {'id': '@id'}, { groups: { method: 'GET', url: ...
2
votes
0answers
166 views

Is it possible to use parameterized URL templates with angular $http service

I'm using $resource for my RESTful api's and love the parameterized URL template for example 'api/clients/:clientId' This works great for CRUD operations. Some of my api's however are just reports or ...
2
votes
0answers
95 views

Using Angular Client with WebAPI and CORS

I've a problem for sending data to the server via POST/DELETE. I always get a CORS error when I'm trying to send data to the WebAPI. The client-side was implemented with AngularJS and the server-side ...
2
votes
0answers
115 views

Get Data Object Underlying Angular $resource get() Response Object

Problem $resource does not return raw JSON object Explanation When I use the get() method on the ng $resource class, I am returned a Resource object that has the data I want, along with extras like ...
2
votes
0answers
495 views

Reject Angularjs resource promises

So I'm working on a Angularjs based mobile app. When a user taps on each of the tabs along the bottom a new route is called which is loading the partial and controller. In my controllers I often ...
2
votes
0answers
107 views

Not the typical “TypeError: Object #<Resource> 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 ...
2
votes
0answers
479 views

Downloading an XML file using angularJs resource

I'm trying to use angularJs resource to download a file from a server but it dosen't work. my code is as following: // service angular.module("someModule") .factory('generate', ['$resource', ...
2
votes
0answers
815 views

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', { ...
2
votes
0answers
115 views

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 ...
1
vote
0answers
32 views

Do $resource instance objects support GET methods or not?

According to the Angular documentation for $resource, invoking an action method on the resource class object returns an instance object and all of the non-GET methods are available with $ prefix. ...
1
vote
0answers
43 views

angular resource put request with array like params

I have to recreate the following url using angular resource, but i have been trying and can't do it: my_domain/plan_memberships/24?access_token={{access_token}}&plan_membership[archived]=1 the ...
1
vote
0answers
42 views

Angular Factory, Service, and Controller not Working Together with $Resource

I have an Angular service that's just a setter and getter for a variable I need to pass between controllers: var MyApp = angular.module('MyApp', ['ngResource', 'ngRoute']) .service('userToken', ...
1
vote
0answers
83 views

Read post response in AngularJS service

I'm consuming an post service using in AngularJs, that post returns a boolean value that I can see it in the Google Developer Tools, but I can't find a way to read it in the code, is there a way to ...
1
vote
0answers
40 views

Unify 2 rails resources Angularjs

I have the next resource: angular.module('app').factory 'User', [ '$resource' ($resource) -> $resource '/users/:id/:action', { id: '@id' action: '@action' }, query: ...
1
vote
0answers
45 views

Error handling for special types of $resource request errors

I have a working Angular app that makes requests to a REST API through a $resource service I have set up. Everything works well - I have callbacks for my success and error conditions, and if it is an ...
1
vote
0answers
20 views

How to test AngularJS method that use myRessource.$update?

I'm trying to test the submitForm() method that $scope.warehouse.$update but I got the following error. Error TypeError: 'null' is not an object (evaluating '$scope.warehouse.$update') at ...
1
vote
0answers
61 views

Javascript controller print blank for FileSystemResource

I want to display an image in the page which is returned from a spring controller as file system resource . My java code : public FileSystemResource RetrieveLogo(@PathVariable("UniqueCode") String ...
1
vote
0answers
132 views

MEAN add an object that utilize two existing models

Hi I am experimenting with MEANjs for development. I have made an app that consist of CRUD for "Accounts", "Incomes" and "Expenses". Each of which are created using yo meanjs:crud-module ...
1
vote
0answers
57 views

how to handle errors using $RESOURCE in angularjs?

i am trying to handle the "server side error codes" in angularjs like this but it is not working $timeout(function() { $scope.register.sales_total_amount=data2; ...
1
vote
0answers
101 views

prevent angular update from overriding updated form data

When performing an update using ngResource, any changes the user makes to the form between when the update is sent and received is lost when the update returns. What can I do to ensure that any ...
1
vote
0answers
132 views

Clever bulk update in Angular $resource

Here's what I'd like to achieve: Say you have a todo list and do the following changes: Mark as complete task 1 Change the name of task 2 Mark as complete task 2 Change the name of task 1 At ...
1
vote
0answers
338 views

Connecting AngularJS frontend web to my Spring MVC RESTful service

I have a Spring BOOT MVC RESTful API, which is successfully accepting GET PUT POST and DELETE requests when I test it with a REST application (like Postman for Chrome). E.g. manually I can do ...
1
vote
0answers
59 views

Why does Angular $resource add parameters twice, in some cases?

This code: var CompanyRecruiters = $resource('/admin/companies/:id/recruiters.json', {id: '@id'}); // create a new employee var employeeResource = new CompanyRecruiters(); ...
1
vote
0answers
271 views

Sending POST request with form-urlencoded parameters in AngularJS using ngResource

I am trying to do a POST request with ngResources in AngularJS, I want to send my parameters in url and I have changed headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, in $save method ...
1
vote
0answers
58 views

how to create $resource custom config params to read in an interceptor

I want to create an interceptor that only takes action for specific $resource calls. I want the $resource calls themselves to specify whether they should be intercepted, rather than creating and ...
1
vote
0answers
108 views

Wrap related models using ngResource in AngularJs

I have following resources in frontend: .factory('TaskComment', function ($resource) { return $resource('/api/me/task-comments/:id', {id: '@id'}, { object: {method: 'GET', params: {id: ...
1
vote
0answers
39 views

Extracting cookies from $resource

This seems like it should be dead simple. I want to use $resource to save() something to the server. The server will respond with a cookie. I need to use that cookie on my next request. Somehow, in ...
1
vote
0answers
587 views

Unit test cases for Angular factory using jasmine/karma

I have good understanding on Angular however never written any test cases for Angular code therefore have very little understanding on how and what test cases needs to write for factories. I have ...
1
vote
0answers
395 views

$resource query() is not displaying the latest data after a server-side data modification was done

Scenario The initial $resource query() retrieves an object containing 'A', 'B', & 'C' entries from the server. The user then goes to a different Add Entry Screen and adds a 'D' entry. This ...
1
vote
0answers
93 views

Angular template variable only works on hover

In my template I have the following: <small class="badge"> {{reservationsCount}} </small> {{reservationsCount}} is returned by a promise, however, it doesn't render unless: I ...
1
vote
0answers
149 views

Generate Symfony Url in angular resource using FosJsBundle

I want genereate url in angular resource using FOSJSBundle. This is the code that need FOSJSBundle to generate url: Routing.generate('get_constructionprivateinformation_industrialists', {id: id}, ...
1
vote
0answers
163 views

AngularJs input[type=file] bug

I want to handle file uploads using angularjs. I have settled up a model, view, controller and service that is included in the controller: #Model window.App.factory 'RepositoryItem', ...
1
vote
0answers
950 views

AngularJs $resource use of isArray for both request and response

Not sure if this is a stupid question or not, maybe I'm missing something. When customizing methods on $resource I can use isArray to specify if the resource is an array or not. The problem is that ...
1
vote
0answers
47 views

$resource with custom action and url doesn't work

I would like to add the $update method to the Todo object. Here's my code: destinataire_id=10 var Todo = $resource('todosjson?destinataire_id=:destinataire_id', {}, {"update": { ...
1
vote
0answers
321 views

error callback in angular resource like

I'm having trouble while using ng-resource in django because it always removes the trailing slash. So I follow http://stackoverflow.com/users/192810/misko-hevery guide ...
0
votes
0answers
11 views

using ngResource with webpack

Good morning everyone, I recently started using webpack on a new angular project. I really like it, very easy to use. I just have one problem, for now. I'm trying to import ngResource to use on one ...
0
votes
0answers
12 views

Multiple parameters angular promise returns undefined

I've been trying to follow this passing of multiple of parameters here But got errors. The $promise returns undefined. app.factory('ListUserResource', ListUserResource); ListUserResource.$inject = ...
0
votes
0answers
48 views

Send request again using $resource when responseError is intercepted

I'm using $resources api in Angular to manage my restful api, i'm using an interceptor to catch responseError, to re-send again the same $resources request when an error occurs (really only when a ...
0
votes
0answers
18 views

Angular js $resource with custom function

So i have a $resource ProductVariant, declared like : app.factory('ProductVariant', ['$resource', '$odataresource', function ($resource, $odataresource) { return ...
0
votes
0answers
13 views

angular $resource - post subset of data

I want to create custom action in resource, that do not post all the data getted from the server. For example: var Resource = $resource('/url/:resourceId', {'resourceId': '@id'}, { ...
0
votes
0answers
20 views

Retry requests that timeout using angular $resource inside the failure callback

Im trying to retry a request that failed due to a timeout or some other reason. I want to do this inside the failure callback without having to use any interceptor. Is that possible? $resource(url, ...
0
votes
0answers
16 views

AngularJS, `$resource` default parameter depend on mandatory parameter

I'm writing a little app in javascript and wondered if it is possible to access a mandatory parameter of a $resource to figure out the correct default parameters. Think of a localized app, where ...
0
votes
0answers
25 views

can't move data from view (html) to a resource call (ngResource)

I've got an AngularJS App with this view (only a extract, of course): <div ng-controller="customersCtrlDetail" ng-init="intCode='1'"> <input type="text" ng-model="intCode" /><br/> ...
0
votes
0answers
20 views

Doing repeatedly $remove request to the server with AngularJs gives a 500

When doing $remove request rapidly the server (express) will give an 500 error. Is there a way to chain $remove requests to the server or do something else to make it work? This is my controller ...
0
votes
0answers
10 views

$mongolabResourceHttp can pass a dynamic collection?

As I spend a dynamic collection to the factory? I'm trying some ways and still can not, I tried to pass the parameter :collection, but does not. Any idea? .factory('ALL', ...
0
votes
0answers
43 views

Angular Webservices, why correct code?

I would hit my password, because I've read several times about $ promisse and $ q. I've read also that it is the surest way to set up a factory, below What do I use today to fetch the data for my ...
0
votes
0answers
116 views

Get response data from Angular Factory using $resource

I try to get response data from angular service created by factory and $resource. I want to send POST request to server to create object in db and received created ID. So I create service like this: ...