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.
1
vote
2answers
19 views
$http.get with null parameters are not hitting the Web API controller
I am trying to get to Web API GET controller using $http.get in angular application as follows :
$http.get(BasePath + '/api/documentapi/GetDocuments/' ,
{
...
0
votes
1answer
23 views
Angular HTTP request blocked - Showing mixed content
Angular HTTP request is blocked - Showing mixed content.
But when i'm accessing through browser URL, the content is showing.
The angular code is:
...
1
vote
2answers
22 views
Execute code within a factory when needed, not when loaded into controller
Factory:
.factory("myFac", ['$http', '$q', function($http, $q) {
var defer = $q.defer();
$http.get('some/sample/url').then(function (response) { //success
/*
* Do ...
1
vote
3answers
44 views
How to make a $http request from the rest client in AngularJs?
Have this scenario when I make a request via $http in the first service, and then I want to manipulate the data in other service. For some reassons my returned object is empty. Any advice ?
...
0
votes
2answers
38 views
Unable to reflect $http response in the view ng-repeat
I have seen other questions relating to this and implemented the answers to the best of my understanding. But, I am unable to display the response in the view with ng-repeat. Here is my code.
JS ...
157
votes
26answers
228k views
AngularJs $http.post() does not send data
I'm pulling my hair out - could anyone tell me why the following statement does not send the post data to the designated url? The url is called but on the server when I print $_POST - I get an empty ...
1
vote
2answers
37 views
How can I get the response of an interceptor on my own defined service in Angular.js?
I have an Angular app with a service (EqService), for which I want to know the Timestamp Marker in the asynchronous call.
I'm using request and response interceptors. The key components are like so:
...
0
votes
1answer
36 views
How to wait till the response comes from the rest client, in AngularJs?
I have a Rest Service witch returns : {dataRef:Array[3],status:Object}.
When I inject the service in the controller and run the application, I still have trouble with returning the data from my rest ...
0
votes
0answers
13 views
Angular $resource vs $http and escaping/encoding parameters
What am I doing wrong. I want to use $resource to do my queries but when I attempt to escape the parameter it doesn't escape properly. But if I use $http.get it will escape correctly. Version of ...
0
votes
0answers
20 views
How to pass parameters from AngularJS to SpringMVC in Nested Object
There are three ng-model in page like this:
ng-model="user.addr.location"
ng-model="user.addr.number"
ng-model="user.name"
HTTP request in AngularJS:
$http({
url: "/login",
method: "POST",
...
1
vote
3answers
3k views
Getting data from a web service with Angular.js
Im trying to get data in a Json format from a remote WS using Angular and im having some trouble.
The data comes from the web service correctly but i cant use it inside the controller.
Why is that?
...
1
vote
1answer
16 views
AngularJS $http request to Coursera's REST API. Cross-origin denied although public key is not required
Coursera API documentation:
https://tech.coursera.org/app-platform/catalog/
I tried to make a simple GET call to the api:
https://api.coursera.org/api/courses.v1
Like This:
...
3
votes
2answers
78 views
Handle Angular $http errors locally with fallback to global error handling
I have a component based Angular application where the individual components load their respective data. When errors occur I generally want the component to display an error message.
However, in some ...
0
votes
0answers
23 views
Angular2 failing to read component attribute inside a method
So I have a form where the user enter his credentials.
In the onSubmit function I will compare the input values with the stored values .
The stored values were read from JSON file in the constructor.
...
1
vote
4answers
46 views
AngularJS catch all status-codes for $http actions?
My $http functions can return the following errors:
POST http://foobar.dev/foobar 500 (Internal Server Error)
POST http://foobar.dev/foobar 401 (Unauthorized)
Isn't there a way I can catch ...
5
votes
1answer
2k views
Reject from 'response' into 'responseError'
Sometimes, the API I'm using will return 200 ok even though there has been an error. The response JSON object will look something like:
{
error: true
}
I've built a $http response interceptor ...
1
vote
1answer
43 views
What's the nicest way to wait for a promise initiated on a directive to resolve?
This is a simple form that contains one input field with a directive. If the input is valid, the directive will call a remote server. The response will populate the form model with some extra data.
...
2
votes
0answers
64 views
in $http. What is wrong with this code?
I made a function to do it. getTemplate it called
And I call it from templateUrl and I gives him the name of the state
I do not understand why it does not work for me,
Even it does not make me alert ...
359
votes
20answers
224k views
How can I post data as form data instead of a request payload?
In the code below, the AngularJS $http method calls the URL, and submits the xsrf object as a "Request Payload" (as described in the Chrome debugger network tab). The jQuery $.ajax method does the ...
2
votes
1answer
44 views
How to use ngResource-like query urls with $http
I'm using Angular and I've got to do some not-restful ajax calls. And, because of that I can't use ngResource. My URL are something like /admin/:someId or /admin/:someId/users/:someUserId.
The ...
0
votes
0answers
27 views
AngularJS using angular-twilio library getting Error message after POST request
So i have issue with angular-twilio(here) library when i want send SMS to number it returns in Network -
{"code": 21603, "message": "A 'From' phone number is required.", "more_info": ...
1
vote
2answers
9k views
AngularJS $http.post
I am trying to do an $http.post and get the response, I tried in several ways but I can't get it working.
The data I am sending (userData) is an json object.
$http.post(url, userData)
...
0
votes
2answers
37 views
AngularJS: How to sync an http call with a variable?
I'm trying to do a general function inside a controller which gives me the data from the backend and assign this data to a variable.
I have made this code, but it doesn't work correctly.
...
0
votes
0answers
34 views
Twitter Returns Error while Accessing GET statuses/user_timeline using AngularJS
I am trying to access Twitter GET statuses/user_timeline using Angularjs
. I already have the bearer token with me. I am trying to do Application Only Authentication using Angularjs.
Error Code
...
0
votes
0answers
5 views
Implementing an upload progress bar - sessions are not working properly
I am using the default express-session module for handling sessions with a redis store. The scheme is whenever a user uploads multiple files, on the server side I have a property of req.session named ...
1
vote
2answers
470 views
How to prioritize requests in angular $http service?
I'm working on an application with a large amount of lazy data loading. I would like to prioritize http requests based on 'priority' param.
This is the concept of using it.
$http.get(url, {params: ...
0
votes
0answers
31 views
Post Image on Twitter
I am developing an app. I have done Login Using OAuth. Now i want to post an Image to my Twitter Account.But each time i am getting Capacity Over Error message.I tried with Both media and media_data ...
1
vote
1answer
21 views
Prevent previous, yet longer-running $http request from returning after most recent request
I just came across a weird situation and wasn't able to find an answer for after some searching.
I have a textbox that I'm using to allow a user to type keywords to filter table data. I have an ...
1
vote
2answers
507 views
AngularJS / Alfresco / CORS filter issue: No 'Access-Control-Allow-Origin' header
I have some problem with Alfresco (5.0.d), my AngularJS (1.4.3) client and the CORS settings (typical cross-domain / No'Access-Control-Allow-Origin' header is present on the requested resource ...
0
votes
2answers
28 views
How to make controller wait untill app.run finishes
In my application, I'm getting some data in app.run using $http.get()
The result from this is required to proceed to the controller.
Currently my controller is executing before the completion of this ...
0
votes
1answer
98 views
“$httpBackend.when is not a function” error when mocking AngularJS $httpBackend in Jasmine tests and using a decorator
I'm using a decorator for Angular service $httpBackend to change the urls of all http calls:
app.config(function($provide) {
$provide.decorator('$httpBackend', function($delegate) {
return ...
4
votes
4answers
8k views
Angular $http.get to localhost, always returns 404. 200 in browser
I can't create a successful get request in Angular 1.2.13.
var getProgress = function() {
var promise = $http({method: 'GET', url: 'http://localhost:8080/project/local/some/getStatus'});
...
1
vote
1answer
624 views
HTTPS with $http in Angular not working
I'm building a Facebook Tab using Angular. I'm doing a $http request to a PHP page on the same domain. The request looks like this:
$http({
method: 'JSONP',
url: ...
153
votes
10answers
141k views
Processing $http response in service
I recently posted a detailed description of the issue I am facing here at SO. As I couldn't send an actual $http request, I used timeout to simulate asynchronous behavior. Data binding from my model ...
0
votes
1answer
37 views
AngularJS http interceptor with selective url
How to have an $http interceptor to react only to given patterns?
For instance, i would like the interceptor to handle every "/api/*" request and leave the other requests alone.
0
votes
2answers
72 views
Why is $httpProvider.interceptors returning an `undefined` value
I've created a basic AngularJS app that consumes Yelp's API and am having trouble using $httpProvider.interceptors to parse my response.
Here is my app:
var app = angular.module("restaurantList", ...
0
votes
3answers
186 views
Angularjs $http promise defer
I am working with the $http in AngularJS 1.4.7
I need to separate my controllers from any $http requests. So i created a service as follows
app.service('MyService', function($http, $q, $rootScope){
...
1
vote
3answers
55 views
How can I do http request in Angular, and have functions that returns all elements of Json or just one?
I'm new in Angular and Ionic,
and I want to build one factory that gets one Json from googleapis,
and contains two functions, one returns all the elements, and another that returns the element passing ...
1
vote
2answers
125 views
Angularjs $http returning results without being complete using $q.defer
I have a issue with angular where results are returned to my controller before its actually complete even though i am using the $q.defer functionality. I have the following function in my Service ...
3
votes
2answers
74 views
How can I extend the $http service in angular?
Unfortunately, we're stuck running 1.2.26 (will upgrade to 1.2.28 when it's gemified).
In the meantime, how can I patch (heh) $http so that the short-hand patch method is available? I'm pretty new to ...
1
vote
2answers
131 views
angularjs $http : sending special characters in path param
I am trying to invoke a REST service which has a special character in its path params. The rest url looks like,
rest\fetchDetails\[1,2,3]
I am just invoking it using $http like,
...
3
votes
4answers
169 views
Integrating SocketIO to an angular app for http requests
I have created simple Angular app that uses Yahoo Finance to pull some currency data. However, at present, it pulls the data, but it is not until i reload the page that the currency changes, which is ...
1
vote
2answers
273 views
Ionic. Return factory from data from JSON file
I'm playing around with Ionic sample projects and am looking for a way to pull in the data from a json file rather than just the standard array that is in the project.
I have successfully modified ...
2
votes
1answer
496 views
Why does angular $http provide a headersGetter instead of just headers?
When using $http the callback functions are called with a headers getter. This often results in the following code:
$http.get('example.json').success(function(data, status, headersGetter, config) {
...
4
votes
1answer
2k 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: {
...
1
vote
1answer
73 views
How to cancel pending API calls in Angular JS
I have a Search box and for every letter a user types I have 4 API calls being made.
and if user types a long word , many API calls goes in pending state. with every new letter which user types how do ...
2
votes
1answer
6k views
How to read response headers in angularjs?
My server returns this kind of header: Content-Range:0-10/0:
I tried to read this header in angular with no luck:
var promise = $http.get(url, {
params: query
}).then(function(response) {
...
0
votes
1answer
157 views
AngularJS: Return different values for $http success() or error()
In a controller I have this function:
bar.updateData = function(val) {
$http.put('url/foo/', {
param : val
}).success(function(data){
return true;
...
1
vote
2answers
45 views
AngularJS - how to pass a scope variable to a service?
This is my controller, in which I have a variable that I want to use in my service, in order to access some JSON data from the server.
Parts of the controller where I:
1) get the API key from the ...
2
votes
1answer
59 views
Correct way to set and override a request header in Angular
I need to set a global http header to all my requests because of the authentication method that we are using. We have an Identity Server to authenticate the user using a SSO approach. So far so good, ...