Skip to main content

All Questions

Filter by
Sorted by
Tagged with
5 votes
1 answer
108 views

Run a hook before $resource constructs the url?

I want to programatically alter route parameters before $resource constructs the url. I cannot use angular's http interceptor to do this, since the route is already concatenated at that point. Given ...
Daniel Lizik's user avatar
  • 3,144
0 votes
2 answers
3k views

how to parse a $resource object in angularJS

I have one annoying problem here that I need help with. I have a controller that fetches stock data from yahoo stocks. The controller stores the data in $scope.stocks, in my view I can display the ...
Buya Nami's user avatar
0 votes
2 answers
781 views

Using two $http methods and saving data in an object Angular

I'm trying to getting data from one resource within a controller and with the result, I have to do a second http get request. $http.get('http://' + ProductionConfig.SERVER + '/api/v1/business-...
JesusMurF's user avatar
  • 296
0 votes
1 answer
124 views

Angular $resources when to use callback functions and how to get the object "clean"

I've problem with $resources and I didn't really understood when I can simply assign a variable to a $resource response var user = Users.getCurrent() or when I've to use the callBack. I created a ...
EsseTi's user avatar
  • 4,331
0 votes
1 answer
2k views

Add a custom header in http get request angularjs.

This is my angularjs request. var req = { method: 'GET', url: 'http://localhost:8080/test', headers: { "x-auth-token" : user.token ...
Jimmy's user avatar
  • 1,873
1 vote
0 answers
289 views

AngularJS ngResource and IE9 issue: response.data is undefined in the error callback function

ISSUE: In IE9, when I call $resource.save, I get undefined on response.data inside the error callback function. In chrome, response.data has the "errors" JSON object returned from the server. Here ...
RRK's user avatar
  • 465
2 votes
2 answers
3k views

Building a '$resource' service for multiple API calls

I have created a factory service that can get data from an API with the following code. app.factory('Book', ['$resource','$http', function($resource, $http) { return $resource('http://someurl.com/...
Nicklas Kevin Frank's user avatar
4 votes
3 answers
2k views

With AngularJS, I don't want to set the global $http.defaults.headers.common. Can I send my custom header with each $resource call?

I'm calling a back-end server that I cannot control. Currently it's using jQuery ajax like this: return $.ajax({ type: "POST", url: "/api/cases/store", contentType: "application/json", ...
Daisha Lynn's user avatar
0 votes
1 answer
122 views

AngularJS: Unexpected undefined in chained results

I've come across this issue before with nested directives, but I managed to find a workaround there. I have code that looks a bit like, var token = API.callGeneric({}, {method: 'kds.getTokenExtended2'...
Idkt's user avatar
  • 2,993
2 votes
1 answer
2k views

AngularJS - How to handle promises correctly

I have setup an AngularJS resource: app.factory('gridData', function($resource) { var csrf = 'asdf'; return $resource('/my/url/:expID', {expID:'@id'},{ get: {method:'...
Thomas Kremmel's user avatar
0 votes
1 answer
69 views

AngularJS: issues creating an API request

I have a scenario in which I have to deal with a misconfigured server, which only understands a stringified JSON. What works with the server is: var req = JSON.stringify({id: 0, method: 'getToken'...
Idkt's user avatar
  • 2,993
1 vote
0 answers
683 views

Angular resource dynamic uri

Once I was using $http in calling all my apis' endpoint. But lately I read that using $resource is much more robust or best practice. Now I'm migrating all my $http call to $resource and I got bump on ...
user2720708's user avatar
2 votes
1 answer
1k views

Why the difference in using common and post for changing the ContentType should affect the request payload / form data?

If I use the following: a) angularApp.config(function ($httpProvider) { $httpProvider.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; $httpProvider.defaults.headers....
Kim Stacks's user avatar
  • 10.9k
0 votes
1 answer
118 views

How to ensure that angular $resource uses the following angular $http settings?

I am using CakePHP as my backend. Therefore, if I use $http, I need to have the following: a) the default config must be angularApp.config(function ($httpProvider) { $httpProvider.defaults....
Kim Stacks's user avatar
  • 10.9k