AngularJS tag for $http service is a core Angular service that facilitates communication with the remote HTTP servers via the browser's XMLHttpRequest object or via JSONP.

learn more… | top users | synonyms

0
votes
0answers
19 views

angularjs while Posting multpart data its getting converted to string

while sending POST request with multipart data with image and other fields in angularjs , boolean values getting converted to string how to resolve it. var fd=new FormData(); ...
2
votes
1answer
179 views

Promise Resolution after $http success is getting mixed up

I have created a factory, to handle all my http related calls. It returns following inline code: return { get: function (opts) { var deferred = $q.defer(); var def ...
52
votes
3answers
87k views

How to enable CORS in AngularJs

I have created a demo using JavaScript for Flickr photo search API. Now I am converting it to the AngularJs. I have searched on internet and found below configuration. Configuration: ...
-1
votes
1answer
24 views

Scope of $http callback in ES6

I'm trying to write a quick test that uses ES6 and Angular to call an API - but I can't quite work out how to scope the injected values into the callbacks - in all cases they seem to be completely ...
0
votes
2answers
29 views

Return value from nested http.put

How to return response object from http.put to controller as return value from TestFunction? response from http.get is printed OK but putResponse is undefined. During debug I can see that http.put ...
2
votes
3answers
35 views

FileReader JS Api Call Fire before it's ready

I'm trying to read a file, create a "FileContainer", and a DataUrl from a fileReader so i can send it to a web api. My problem is that the Api call fires before my object is created, so i send Null ...
5
votes
1answer
42 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 ...
0
votes
1answer
27 views

HTTP headers are not being sent in CORS GET from AngularJS application

My problem is that HTTP headers are not being sent from my AngularJS HTTP GET requests. However, for a HTTP POST, I do see the headers being set. These HTTP requests are over CORS. Although there are ...
3
votes
1answer
4k views

TypeError: (intermediate value)(intermediate value).success is not a function (angular)

I have difficulties understanding this error... I dont quite understand why its not a function.... angular.module('mkApp').factory('mkService', function ($http, $log) { function ...
1
vote
1answer
6k views

$http error handling in angular

$http in my angular project not able to recognize 40X(401,403,405...) errors on iOS. I am using 1.2.10 angular version and Cordova version 3.4.0. Below is the code I am using: ...
0
votes
2answers
30 views

Web Method in aspx page not getting executed

I am trying to make an ajax request on page load itself.I am using angular js $http service to get Json data from the web method which is present in my User.aspx.cs page . My Web Method is follows.: ...
0
votes
2answers
64 views

how to prevent duplicated $http requests in AngularJS app?

Really i need to prevent repeatedly send the same request before the previous request will give the the response . I have found out some solutions. somehow i don't need to disable the button while ...
0
votes
0answers
18 views

Getting http response through hurl.it, but not through angularjs http post

Getting response in hurl.it, but not through angularjs http post. The error message is: Mixed Content: The page at .. was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ...
1
vote
0answers
33 views

AngularJS http interceptors responseError never called with IE9

I'm confronted with a problem with $http.get configured with a timeout with IE9 only. When the request is aborted, my http interceptor is never called. Has anyone else also confronted this problem? ...
1
vote
2answers
50 views

Is it possible to have an Angular js $http request inside another request?

I am trying to send a request in AngularJS to get a token for user registration. Once I get the token, I am sending another request using the token to register the user. However the first request ...
0
votes
0answers
40 views

$http status 0 angularJS

I'm developing a mobile application using ionic and angular. I have a problem when invoking $http post function sometimes it works but sometimes it does not. When it does not, it return status 0. It ...
0
votes
2answers
33 views

Refer to service in run immediately after definition?

I would like to attach a string from a service to every request. Attempt: 'use strict'; angular.module('main') .service('Foo', function () { self.bar = 'haz'; }) .run(function ...
0
votes
2answers
66 views

Output page blank while fetching data from JSON file in AngularJS

I have just started learning angularjs, I'm trying to load data from my json file on view. json file has a list of houses. But does not get showed on my view when I load the index.html file. ...
5
votes
2answers
4k views

AngularJS : controller scope won't sync with promise

I've picked up a project and I'm trying to return some data from a service to my controller. I've been at this for about 12 hours, and have tried different methods. They all usually result in this ...
2
votes
1answer
34 views

Random sequence of response in $http.get

I'm trying to write a function that sends multiple requests to the server based on the number of Ids in the idArray. The problem I'm facing is that the data that is pushed into the dataArray does not ...
29
votes
8answers
36k views

The 'Access-Control-Allow-Origin' header contains multiple values

I'm using AngularJS $http on the client side to access an endpoint of a ASP.NET Web API application on the server side. As the client is hosted on a different domain as the server, I need CORS. It ...
1
vote
1answer
54 views

AngularJS $http setting headers

I'm trying to set http in AngularJS, but it seems I'm doing something wrong. app.controller("mainCtrl", function ($scope, $http) { $http({ method: 'GET', url: '***', ...
0
votes
0answers
20 views

How to determine connection error reason in Ajax call

I found that a few clients where getting errors from an Ajax request in JS. The backend application is not getting the requests so I need to determine at which point in the connection proccess the ...
4
votes
2answers
6k views

What is the equivalent of jQuery ajax beforeSend in Angularjs?

I am familiar with Jquery AJAX call, which has different callbacks like beforeSend, success, complete, etc. This is the example AJAX call with Jquery: $.ajax({ url: 'register.php', type: 'POST', ...
4
votes
1answer
516 views

How to test $http without mock with jasmine and angular-mocks?

I want to make an integration test with real calls to my server, so, I don't want to use the $httpBackend module from angular-mocks, So I try this: ...
6
votes
2answers
7k views

Angular Js - set token on header default

Im trying to add a header with my access token to each API call. It works well for all the GET requests, but as soon as I try to make a POST the header isn't added. Here is how I add the token: ...
29
votes
8answers
74k views

AngularJS not detecting Access-Control-Allow-Origin header?

I am running an angular app on a local virtualhost (http://foo.app:8000). It is making a request to another local VirtualHost (http://bar.app:8000) using $http.post. ...
13
votes
2answers
10k views

Getting AngularJS Error: “[$rootScope:inprog] $digest already in progress” without a manual $apply

Other posts on this error always include someone trying to $apply without using a safe apply, but that's not the case in my example. My function IS successfully returning the data I requested from the ...
22
votes
9answers
13k views

Angular 2: How to use/import the http module?

I've been playing with Angular 2 Quickstart. How can I use/import http module in Angular 2? I've looked at Angular 2 Todo's .js, but it doesn't use the http module. I've added "ngHttp": ...
1
vote
1answer
122 views

AngularJS spring security login/logout with Cross-Origin Resource Sharing (CORS)

Problem Statement: My UI app is running on 9000 port(grunt project) and my server side spring boot project running on 8421 port. I am able to hit all the URL's from my UI app except login and logout. ...
1
vote
0answers
70 views

form not submited properly in angularjs with struts2

I am using struts2 framework with angularjs.There are two buttons one for reset the texts fields with default value and other is to submit the page. my submit is not working. My jsp page is:- ...
1
vote
1answer
35 views

$q.all with nested promise also created with $q.all

The following function tries to return a promise that will only resolve when all the async HTTP calls have finished: $scope.saveThat = function () { var promises = []; for (var i = 0; i < ...
1
vote
2answers
70 views

use $http.get in a service/factory to return a collection

I try to use a http.get promise in an angularjs service, do some manipulation on the obtained collection and finally return it to a controller... My question is how to use a $http.get() in a service ...
1
vote
2answers
26 views

data.data for reading my json

I have this factory: 'use strict'; angular.module('testCon').factory('UserService', function ($http) { return { getAll: function () { return ...
0
votes
2answers
207 views

Slim Post method not working with AngularJs Http Request

This is my AngularJS controller : app.controller('emailConfirmCtrl', function ($scope, $http) { $scope.check_credentials = function () { var request = $http({ method: 'POST', url: ...
0
votes
2answers
5k views

angularjs: $http basic authentication

I tried angular.js and started with a web-ui for a restful api (using http basic auth). It is really nice and all except the authorization works. Up to now I am using ...
1
vote
2answers
48 views

How to use $routeParams in resolve

I use $routeParams like this right now: My factory function: angular.module('fifaApp') .factory('FifaService', ['$http', function($http) { var sdo = { getTeamDetails: ...
1
vote
1answer
55 views

AngularJS : How to get returned value from factory

I am very much new in AngularJS and I have the following problem: View: <div> <form role="form" name="loginForm" class="form-horizontal login-form"> <div ...
2
votes
2answers
26 views

Getting asynchronous data from service

I try to request some data in a service. I wanna make sure sure that the data is saved in a variable of the service, since due to state changes, my controller will reload all the time and I need the ...
2
votes
1answer
1k views

Sending HTTP Post with multiple data through AngularJS

I am using AngularJS. I would like to send multiple data in a HTTP post through AngularJS. The backend runs Cakephp and I have verified that the Rest API works through python HTTP-post. I have this ...
39
votes
5answers
37k views

Using success/error/finally/catch with Promises in AngularJS

I'm using $http in AngularJs, and I'm not sure on how to use the returned promise and to handle errors. I have this code: $http.get(url) .success(function (data) { // Handle data }) ...
-1
votes
1answer
73 views

How to load returned html after $http.post

Sorry if this has been asked already, but I can't find an answer! I'm posting what could almost be form data using angular, and expecting the backend to return an html page. How do I load that page? ...
3
votes
3answers
480 views

How to pass client-side parameters to the server-side in Angular/Node.js/Express

Probably a very basic question, but I cannot seem to find a simple answer. I have a GET method leveraging Angular's $http that is requesting a promise from a particular url (URL_OF_INTEREST). On ...
1
vote
1answer
45 views

AngularJS Get Method Not Work

I have an angular application, and I am trying to get a list of users from the server. I ran into an issue. I have page call CurrentUsers. If CurrentUsers method returns a Json Object, the entire ...
2
votes
4answers
152 views

AngularJS $http use response in multiple controllers

I have an app where I am loading a bunch of albums in one partial and then when a user clicks on each individual album, they get details for the album like songs, etc. Right now I am pulling the data ...
0
votes
0answers
34 views

Use Pace.ignore() function with AngularJs

I managed to use pace.js in my angular application. Now I want to hide the loading bar for specific $http calls. I wrap the call with Pace.ignore() but the loading bar still show up... Code : ...
2
votes
5answers
907 views

AngularJS, $http.get() and “controller as”

I'm pretty new to the whole AngularJS world and how it works, however I am struggling to get it working as expected. I know that its something to do with the way I am using $http.get() and trying to ...
0
votes
2answers
84 views

AngularJS : Returning .then() response to controller property

I'm using a factory to retrieve data using $http and the controllerAs capabilities to inject into my view. Without the use of the $scope, I am having issues returning the $http response data into a ...
1
vote
2answers
477 views

AngularJS : returning data from service to controller

I am trying to create a service to get json and pass it to me homeCtrl I can get the data but when a pass it to my homeCtrl it always returns undefined. Im stuck. MY SERVICE var myService = ...
1
vote
0answers
89 views

Angular $http get failing on json data with forward slash

My Angular get request fails when the JSON data I retrieve contains forward slashes in the data. I'm not sure how to handle such data as specially as I am using $http.get. Here is the related code: ...