Questions tagged [angular-http]

AngularJS's $http service tag plays a crucial role in enabling communication with external HTTP servers through the browser's XMLHttpRequest object or using JSONP.

Http' does not have the 'update' property

I recently implemented Angular 2 Release and utilized 'Http' from '@angular/http' for my project. However, I encountered an error when I invoked the method 'update', which resulted in the following message: "Evidently, the property 'update' does not e ...

Utilizing exclusively GET requests with API communication - whether through $http or $ $resource

When it comes to making basic GET requests from an API without full CRUD operations, the question arises - is it better to use $http or $resource? It is noted that $resource utilizes $http in its implementation, leading some to wonder if using $resource m ...

Using Angular 6 HttpClient to retrieve an object of a specific class

Previously, we were able to validate objects returned from http api calls using the instanceof keyword in Angular. However, with the introduction of the new HttpClient Module, this method no longer works. I have tried various simple methods, but the type c ...

The promise catch method does not handle JSON parsing correctly

Utilizing Angular's Http to interact with my API has been successful for handling responses with a status of 200. The data is parsed correctly and outputted as expected within the first .then() block. However, when encountering an error with a status code ...

Additional headers are included in the Access-Control-Request-Headers

I have been struggling to include a customized header in my angular js GET request like so: $http({ method : 'GET', url : s, headers : { "partnerId" : 221, "partnerKey" : "heeHBcntCKZwVsQo" } }) Th ...

Using AngularJS2, store the AJAX data in a class variable

I'm currently working on this code and I'm struggling to understand why the data retrieved through AJAX isn't being assigned to the class variable this.users. Snippet of Code getUsers() { this.http.get('/app/actions.php?method=users') .map((re ...

Encoding URLs in Angular 2 for HTTP POST requests

I am attempting to utilize a service through post with Angular2. Below is my code snippet: var m_dataRequest = this.buildLoginUserPasswordRequest(password, key); let headers = new Headers({ 'Accept': '*/*', &apos ...

Tips for refreshing $('select') with .material_select() once the $http request is finished

Currently, I am utilizing Angular and Materializecss for my project. I am facing an issue where I want to update material_select() after the completion of $http request, but I have been unable to find a suitable solution so far. Here is what I have attemp ...

Switching from using jQuery's $.ajax method to Angular's $http service

I have been working on a jQuery code snippet that works seamlessly across different origins: jQuery.ajax({ url: "http://example.appspot.com/rest/app", type: "POST", data: JSON.stringify({"foo":"bar"}), dataType: "json", contentType: "a ...

Error message stating: "Unable to read property 'then' as it is undefined within Angular nested promises."

I'm having trouble passing data back from a service to a controller in my AngularJS application. The service I am calling inside a factory makes an HTTP request for JSON data and then needs to modify it before returning it to the controller. However, ...

Exploring AngularJS: Understanding the Differences Between $http's Success and Then

Can someone explain the difference between these methods for me? I am curious about the distinctions between .then and .success functions, as well as .error. Thank you. // Simple GET request example: $http({ method: 'GET', url: '/some ...

Storing Angular 4 Http Post response data in an object

I'm currently working with Angular 4 in conjunction with an Asp.net web API. I am facing difficulties in reading the properties of my response. This is how my response appears: https://i.stack.imgur.com/NDJCo.png Here is my post request: postLogin(val ...

"Differences between Angular's $http and jQuery's $ajax: What is the equivalent of dataType

How do I specify the data type for Ajax responses in Angular? For example, it's easy to do in jQuery when wanting the response data to be in html format. jQuery: $.ajax({ url: "script.php", type: "GET", dataType: "html" }); Angular: $http({ met ...

What is the process of organizing information with http in Angular 2?

Currently, I am working through a heroes tutorial and have made progress with the code so far. You can view the code <a href="https://plnkr.co/edit/YHzyzm6ZXt4ESr76mNuB?preview" rel="nofollow noreferrer">here</a>. My next goal is to implement ...

Encountering a net::ERR_EMPTY_RESPONSE error while trying to use the DELETE Method in Angular 4

I have been using the following method to delete data: return this.http.delete(this.ApiURL, new RequestOptions({headers: headers,body: body })) .map((res: Response) => res.json()); However, I encountered the net::ERR_EMPTY_RESPONSE error. Interestingl ...

Angular does not automatically cancel a wrapped HTTP Request when unsubscribing

Update: The reason for not using the built-in HttpClient and instead opting to use our own HttpService is because we need to intercept the response. Our custom HttpService wraps the Angular provided HttpClient to apply headers, authorizations, and perform ...

"The response from an http.post request in Angular 2 is displaying

I'm struggling with a problem that seems impossible to solve. I understand Make no assumptions about the server API. Not all servers return an object with a data property. but I have no clue on how to handle it. How can I send data to: dat ...

Having trouble with `$resource` in AngularJs but everything seems to be working fine with `$http`. Wondering how to transfer the parameters used in `$http`

Having some trouble posting image information to the backend. I attempted using $resource, but it didn't work. However, when I switched to using $http, it seemed to work fine. The issue is that I need to apply additional parameters to $http, and I'm unsure ...