An angularjs factory which creates a resource object that lets you interact with RESTful server-side data sources.
7
votes
0answers
296 views
Comparison of Restangular vs. JSData (formerly Angular-data)
One of the things about Angular that's both a feature and a point of complexity, is that it's not very opinionated about how to interact with a RESTful API. I know about $resource, Restangular, and ...
3
votes
0answers
102 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 ...
3
votes
0answers
1k views
How do I set a conditional $resource timeout in angularjs?
It seems pretty clear how to set a global method to abort http requests. Something along the lines of
$scope.canceller = $q.defer();
var API = $resource('http:/foo.com', {}, {get: {
...
2
votes
0answers
87 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
252 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
605 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
95 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
31 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
39 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
203 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
91 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 ...
1
vote
0answers
43 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
184 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
44 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
244 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 ...
1
vote
0answers
85 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
24 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
489 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
75 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
127 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
145 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
917 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
315 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
26 views
ngResource Access-Control-Allow-Origin
So I got thrown a RESTful API done in Django REST framework. I have set the ngResource GET request for the API
var app = angular.module('myApp', ["ngResource"]);
app.factory("Post", ...
0
votes
0answers
26 views
When navigating quickly to a new page, data is sometimes populated by resource promises that are still resolving from the previous page
I'm writing a site that allows users to explore data and each datum's details.
In particular, there is a page where the datum is loaded in the controller (it requires $scope information that is not ...
0
votes
0answers
18 views
Angular $resource caching data managemet best practices
I am building an Angular web app as follows:
data is retreived and updated using $resource
if data changes on the server side, client is notified using SignalR
some data (e.g. google analytics ...
0
votes
0answers
20 views
Best way to populate nested $resources in AngularJS?
I want to populate nested $resource, but I want to be sure I'm doing it right.
Most likely, the community is already the best option to do it. Can my code regarded as true? Or is there a simpler ...
0
votes
0answers
28 views
Angular resource sends wrong date
I have few datetimes in my controller.(I use datepicker)
His looks like,
var date = new Date()
new Date(date.getFullYear(), date.getMonth(), 1)
>> Date {Sun Mar 01 2015 00:00:00 GMT+0400 ...
0
votes
0answers
11 views
How can I fetch multiple items using $resource in angular?
return Tag.query(opts).$promise;
I have this stubbed out and I want to pass it an array of ids, but I'm not sure what the signature of opts is.
0
votes
0answers
25 views
AngularJs optional header param (token)
My app is using token based auth, but a guest can get data too. So for requesting data, I decided to use ngResource lib and write a factory for it.
First, the auth controller gets a token from the ...
0
votes
0answers
16 views
How to dynamically add obj to array as $resource object with its methods $save etc
I have a real time app that gets list of posts via $resource object. As there is a new post it triggers event post:uploaded with new post object attached via socket.io. It displays OK but I can't use ...
0
votes
0answers
16 views
Augmenting response headers for angular js resource
I would like to allow my rest services to set custom headers like AUTH_NEEDED=0|1. I want to do this globally and redirect the user to the login page. Here is what I have, I just have no idea how I ...
0
votes
0answers
45 views
Updating an Angular resource when dependent value changes
I've recently joined a team working on an Angular app that's roughly (paraphrasing) laid out as follows:
this.appModule = angular.module( 'MainApp', ['MainApp.resourceModule', 'MainApp.configModule', ...
0
votes
0answers
29 views
ngResource not saving properties added since loading
I'm connecting to a service and retrieving an item via angular resource:-
$rootScope.currentItem = Entity.get({ id: $stateParams.id }, function() {
});
This fetches me an entity with properties ...
0
votes
0answers
16 views
Angular resource Error: error:badcfg
I have an provider to fetch data from my api ( expressjs & mongodb ).
In the run block i will will test if the request work.
But angular throws an error: Error: error:badcfg
Response does not ...
0
votes
0answers
24 views
Add property to resources returned from 'query'
I have the following resource:
app.factory('Notes', ['$resource', function($resource) {
return $resource('/task/:taskId/notes/:id', null,
{
'query': {
method:'GET',
...
0
votes
0answers
41 views
how do I do patch with ng-resource when dealing with aggregate REST endpoint
I have a fairly simple CRUD model for my REST. My problem is how to handle PATCH or PUT when I aggregate for performance and to keep common business logic server-side.
Let's say I have a company and ...
0
votes
0answers
61 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 ...
0
votes
0answers
49 views
How to implement tree data structure using $resource?
I have a data structure where each element has a parent of same data type and some properties. So that is a tree structure without any restriction on depth level. I want to use $resource for this to ...
0
votes
0answers
24 views
using http cache in angularjs-rails-resource
I'm using the angularjs-rails-resource project to wrap my http rest services.
One thing I didn't find in documentation is regarding cache, some of my methods should access the server only once and ...
0
votes
0answers
33 views
Angular Resource Query inside For Loop
Let's say I've got an array of orders to save and I want to check each order number doesn't already exist in the DB - if so then great save to DB. What seems to happen is the function runs quicker ...
0
votes
0answers
106 views
$resource different $httpProvider headers for different angular module used together in pp
I have some problem with angular http requests.
I build an app to communicate between many api endpoint (from different sites)
Let assume we have api "X" on www.example.com and api "Y" on ...
0
votes
0answers
56 views
$resource http response code 0?
I'm working on a cordova app using ionic and angular. I've been using $resource to make rest requests to a MVC Web Api project that I'm hosting. Everything has been working great and I've had no ...
0
votes
0answers
177 views
Getting query parameter in AngularJS Resource transformResponse function
I'm trying to create simple "database" in json file, and service for it with function to get specific item from json parsed array.
I'm using sample modified code from angular tutorial:
var ...
0
votes
0answers
61 views
AngularJS multiple concurrent chained $resource calls
I have a need to make multiple concurrent calls to an Angular resource, and chain some actions with the $promise api.
I define a resource like this
myServicesModule.factory('MyResource', ...
0
votes
0answers
52 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 ...
0
votes
0answers
125 views
$resource delete action called on instance throws undefined is not a function exception
I'm a beginner to AngularJs, I'm trying to understand $resource service.
Calling delete action on the resource instance object like this :
$scope.deleteTask = function(task) {
...
0
votes
0answers
15 views
Getting nested resources while getting the index (all)
I am using angular-nested-resource on a RESTful API.
var organizations = nestedResource("/api/organizations/", {
getAll: {method: "GET", isArray: true},
create: {method: "POST"}
});
...
0
votes
0answers
29 views
Track pending requests for $resource
Looks like that the $http service has something like this.
Which can be used to track pending http requests.
I am using $resource for all my XHR requests. Is there a way to track pending $resource ...