angular-http

How to POST binary files with AngularJS (with upload DEMO)

Deadly 提交于 2019-11-26 01:48:03
问题 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 headers and data is bellow, Service url with POST request http://services.example.com/upload.php body in form data j_id = 4124, type = text q_id = 6, type = text u_id = 159931, type = text file = demo.mp4, type = file in my app: $rootScope.uploadQuestion =

How to cancel an $http request in AngularJS?

◇◆丶佛笑我妖孽 提交于 2019-11-26 00:13:22
问题 Given a Ajax request in AngularJS $http.get(\"/backend/\").success(callback); what is the most effective way to cancel that request if another request is launched (same backend, different parameters for instance). 回答1: This feature was added to the 1.1.5 release via a timeout parameter: var canceler = $q.defer(); $http.get('/someUrl', {timeout: canceler.promise}).success(successCallback); // later... canceler.resolve(); // Aborts the $http request if it isn't finished. 回答2: Cancelling Angular

Angular 2 http get not getting

不问归期 提交于 2019-11-25 23:07:28
问题 I new to Angular 2 still learning I am trying to hit a URL with a get call but the get doesn\'t seem to go through even in browser\'s network I cannot find that get URL being called. The program is going to that method console logging above and below that get call but nothing for the get call My service method import { Headers, Http, Response } from \'@angular/http\'; import { Injectable } from \'@angular/core\'; import { Persons } from \'./mock-people\'; import { Person } from \'./person\';

Processing $http response in service

醉酒当歌 提交于 2019-11-25 22:33:52
问题 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 to view is working correct, with the help of @Gloopy Now, when I use $http instead of $timeout (tested locally), I could see the asynchronous request was successful and data is filled with json response in my service. But, my view is not updating. updated Plunkr here 回答1: Here is a Plunk that

AngularJs $http.post() does not send data

这一生的挚爱 提交于 2019-11-25 22:28:44
问题 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 array. If I print message in the console before adding it to the data - it shows the correct content. $http.post(\'request-url\', { \'message\' : message }); I\'ve also tried it with the data as string (with the same outcome): $http.post(\'request-url\', \"message=\" + message); It seem to be working when I use it in the