Tagged Questions
0
votes
1answer
34 views
Getting Error While Requesting Data from php api using angular $http [duplicate]
Error : Failed to load http://localhost/APi/index.php: Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.
js file(angular) - http request
$...
0
votes
3answers
36 views
$http GET request not reaching server from AngularJS app
I have a REST API deployed on localhost with the following GET endpoint: localhost:9000/get-events/1
This endpoint is returning the correct response when I send the request through Postman or through ...
0
votes
1answer
59 views
How to send cookies explicitly with GET request using AngularJs 1
I am working with angularjs - 1.6.
I need to send one http GET request to server along with a cookie explicitly.
I mean, I know once we get authorization done successfully, cookies are being sent ...
1
vote
1answer
71 views
AngularJS HTTP Response Missing Values?
You read that right, this is AngularJS, the old one.
I have an Angular $http.post that returns an object with various values including a fairly large dictionary of more objects that map to a bunch of ...
-1
votes
1answer
25 views
Cannot use $http within angular factory (angular 1.x)
I have added $http at the start of the script but for some reason the $http isn't loaded - how do I log $http into the module rather than the controller
var abcdReportServices = angular.module('...
0
votes
2answers
38 views
AngularJS: Error: [$rootScope:infdig] - Call function in AngularJS view
I wrote a controller containing this function:
$scope.getItemName = function (id) {
sgcdata.get('item', {
_id: id
}).then(function (dataItem) {
return dataItem[0].brand_name + ...
0
votes
1answer
48 views
Service returning before all http calls have completed
I have a controller calling a service, which performs a number of http calls and returns back a set of data to my controller. The problem i am facing is that my service returns some data (typically ...
0
votes
0answers
77 views
Http Post request is not getting successful in angular js(1.5)
I am working on HTTP post request in angular JS (1.5).
First I pass request data to factory method. Call the Http post request and send the response back to controller. But I always get the below ...
0
votes
2answers
37 views
$http promise executes success block even when service returns 404
I'm confused or may be didn't understand how angular promise works. I am trying to write some code blocks for my error handling but I see it's always executing success block in my controller. However ...
1
vote
2answers
32 views
Making multiple AngularJS Post requests to an Express Server? Server crashes on second post request
So given that I can't run these two post requests at the same time in my client, I'm trying to run the second post in the .then section of the first post. Which has always worked fine on my other ...
0
votes
1answer
57 views
How to pass parameters to a $http request service in Angular 1?
Let's say I have a foreign API URL like http://something.com/name/age/gender, where "name", "age" and "gender" are parameters.
As I need to retrieve that data from my Angular 1 App, I created a ....
0
votes
0answers
293 views
AngularJS 1 : $http always return status code -1 when request fails
I would like to intercept 500 error and higher.
I get inspired by:
angular doc
AngularJs - $http.get request, response with -1 status code
and other similar questions
this is the ...
0
votes
1answer
42 views
Angular - Trying to access value outside of $http get success and use it for a filter value
I'm building a silly little Football app. On the first page, I am trying to load the country's top division standings and the coming week's fixtures.
I retrieve the data, using a RESTful Web Service ...
0
votes
1answer
37 views
How to retrieve HTML content from server using $http in AngularJS
I have a requirement like I need to fetch HTML body content using $http service in AngularJS.
When I am trying to get that I am getting entire HTML as a response, but I need only the body part of ...
0
votes
1answer
38 views
Not receiving content headers from Web API to Angular
I have a Web API that I want to return a file and the file details.
HttpResponseMessage result = Request.CreateResponse(HttpStatusCode.OK);
var file = new FileStream(filePath, FileMode.Open, ...
0
votes
0answers
22 views
Angularjs with pdf.js [duplicate]
I am using pdf.js to show pdf page. Please some one help me out.
It is an angular application and I am doing service call to fetch the pdf and am passing to pdf.js
Code Snippet.
$http.get($...
0
votes
0answers
44 views
Cancel running Laravel function when cancelling AngularJS request
I'm building an application using Laravel as the back-end and AngularJS as the front-end. As part of the application, I'm making a post request that triggers a PHP function. That function, which is ...
0
votes
2answers
83 views
Wrap two promise in a function
I have some issue with the return of promise. Before, during an http call, I used a function like this returning one promise:
get_data: function (url)
{
let timestamp = new Date();
return $...
0
votes
1answer
262 views
Angular datatables with promise - reload line
I'm using angular-datatables with promise and everything work's fine. I have a lot of actions that can be done on each register (using angular $http resource) like change a status or something like ...
0
votes
2answers
47 views
Login Timing in AngularJs using `$q(resolve, reject)`
I am having an issue with login timing in an angular app. My intention is that when a user logs in, that the API key is then set in localStorage and is available to call on for accessing the API. ...
0
votes
1answer
258 views
Angular js page reload error during pending http requests
In a single page angular App during the time of ongoing http get requests (before the page is fully loaded) , if i reload the page , all the http request errorcallbacks are called . I use google ...
0
votes
1answer
246 views
401 (Unauthorized) after successful login Angular-node API even using CORS
I am working in Angular,node-express API web app. I am getting Unauthorized even using cors. I am very new to asynchronous world. I show My code snippet below.
node-login API
app.post('/login',(req, ...
1
vote
1answer
504 views
unable to send file with angular post call
I am trying to post .mp4 file with some data through ionic 1 with angular 1. While posting through POSTMAN it is fine and working. I am getting Success = false in my application.
in POSTMAN, no ...
-1
votes
1answer
37 views
$http.put request changing into OPTIONS request in AngularJS 1.3.15 [duplicate]
I'm new to the AngularJS. I'm using AngularJS 1.3.15 version. When I try to call an api with PUT method, It's generating OPTIONS request. I don't know where I'm doing mistake. I tried so many methods ...
0
votes
0answers
45 views
How to push data coming through server in the table for particular columns
I have a table:-
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>Group</th>
<th>User Name</th>
...
0
votes
1answer
66 views
How to separate succesCallback from errorCallback in Angular controller
I have this code:
app.factory('clients', ['$http', function ($http) {
var _getClient = function (clientId, callback) {
callback = callback || function () {};
$http({
...
0
votes
1answer
85 views
Valid JSON with Angular Scope Object variables
Good afternoon S.O. gurus. Its my first time using AngularJS' $http.post and I understand I have to create a variable to save the body of data Im passing before hand, so I created the following:
var ...
1
vote
1answer
26 views
Intercepting $http responses and passing back new brand new responses
I'm creating an eCommerce store that will have to support multiple payment gateways. One of these payment gateways include the National Australian Bank, which doesn't include an API which communicates ...
0
votes
1answer
27 views
Angular http request retry causes multiple insert
I have built an angular app which calls a REST API to insert data into MySQL DB.
The logic is if the app doesn't get response within 10 seconds, it retries the same request.
At the server, there are ...
3
votes
1answer
912 views
Pass datetime from angular $http.get request to Web API 2 controller
I have a web API 2 controller:
[HttpGet]
[Route("api/MyRoute/{date:datetime}")]
public IHttpActionResult Get(DateTime date)
{
return Ok(date);
}
And an angular $http get call:
$http.get("/api/...
0
votes
1answer
90 views
Upload file from angular to API
I'm trying to upload a file via angular.
So far I can select the file and post it from the angular end but I can't get the controller to receive the file.
this is how I post the file:
var f = new ...
0
votes
0answers
36 views
AngularJS post is cancelling with a status of -1
I am getting really stuck with an angular js HTTP post.
I have been using AngularJs in this particular project for nearly two years, and have never had this issue, it is also identical to other code, ...
0
votes
1answer
105 views
Delay $http.get call without affecting angularjs promise
Please note that I already read all the StackOverflow questions that are somewhat related to my questions but none of these really answer my question. Please don't mark this as duplicate without fully ...
0
votes
0answers
42 views
Checking for Angular $http type on $resource error
In Angular 1.6.x I may have several promise invocations, involving e.g. a dialog display, an HTTP call using $resource, and some processing:
showDialog()
.then(foo => {
return ...
0
votes
1answer
453 views
How to make this Angular http get request (with basic authentication) work?
I am trying to debug my angular app with chrome dev console.I want to send a get request to a local server from angular. I've tried the following:
$http = angular.element($0).injector().get('$http');
...
0
votes
2answers
1k views
angularjs : Possibly unhandled rejection $http.get() - Status: -1 CORS [duplicate]
I am getting the below error when using a http get method.
:63502/Scripts/angular.js:14525 Possibly unhandled rejection: {"data":null,"status":-1,"config":{"method":"GET","transformRequest":[null],"...
0
votes
2answers
176 views
Multiple GET requests in Angularjs
I want to make multiple ajax calls from different urls in football-data.org
API.
Here's my code sample:
angular.module('liveFootball', ['ionic'])
.constant('urls', {
BASE: 'http://api.football-...
1
vote
1answer
374 views
Base 64 Image to ocr.space API Ionic 2
I am trying to send a base 64 Jpeg to an API for OCR analysis.
The API docs can be found here https://ocr.space/ocrapi
The code to save the Image is here:
takePicture() {
Camera.getPicture({
...
1
vote
1answer
118 views
Understanding Angular Promises and API Calls — Creating User Dashboard from API
I'm trying to create a simple dashboard that mimics the functionality shown here. I'd like to stick within an angular construct, but I've successfully confused myself into oblivion.I'm pretty new to ...
2
votes
1answer
196 views
How to update $('select').material_select(); after $http complete
I am using angular and materializecss (link). I want after $http complete update material_select() but unable find any solution.
I have tried so far::
1> $('select').material_select();
2> $(...
0
votes
4answers
714 views
How to pass parameter from AngularJS $http.post to ASP .NET Web API core
I want to call ASP .NET Web API from the Angular web page.
I have written the following API:
[HttpPost("Login")]
public async Task<IActionResult> Login(string user)
{
return Json(new ...
0
votes
2answers
3k views
Accessing API with $http POST Content-Type application/x-www-form-urlencoded
I am trying to access this REST API, which accepts three parameters:
stationId, crusherId, monthYear
I am doing it like this in AngularJS as:
$http({
//headers: {'Content-Type':'application/...
1
vote
0answers
164 views
How to differentiate a cancelled request with $http
in a $http error handler, I need to differentiate a real HTTP error from cancelled requests.
Here is an example:
app.controller('Ctrl', function ($http, $q) {
const vm = this;
this.errors = [];...
9
votes
1answer
549 views
Send $http.get twice
Edit 1: Guys, I notice that I call $http.get('/posts') (for some special purpose) in my authentication factory. Sorry for the stupid question. I will delete it when the bounty is end.
I have the ...
1
vote
3answers
304 views
Angular $http error callback not executing
I have nested http calls in my angular application.
$scope.saveAsPaused = function() {
var cmsResponse = saveAtCMS();
cmsResponse.then(function(data){
...
1
vote
3answers
205 views
Migrating $http request to AngularJS V1.6
I upgraded my angularjs package to 1.6.3 and found out that the .success and .error functions got deprecated are removed. Now after using .then and .catch, only the .catch executes. I'm struggling to ...
0
votes
2answers
184 views
http GET request based on true or false condition in angularjs
So basically I want to call all the posts when four conditions satisfy.
Initially,
a=false,
b=false,
c=false,
d=false
When the user selects these options these turn to true
For eg: When user ...
0
votes
3answers
243 views
AngularJS: Unable to Send $Http JSON Response to View
Trying to get JSON data from an API and show the result in a view using AngularJS. I'm able to get the data correctly but unable to show it in the view.
When i try to access the object's data the ...
2
votes
3answers
59 views
Angular Service Not Filtering Data
I am fetching the details from an API using Angular Service and I want to return only the matching items. Meaning, after I type some text, I will click a button, which will call a function in a ...
0
votes
1answer
1k views
Is it possible to upload files' binary data via JSON to the server?
I'm creating an architecture for a SPL (software production line) and I need to make things as easy as possible for the purpose of industrial productivity. The architecture is RESTful, Web API at the ...