Angular JS中的重复http帖子 [英] Duplicate http post in Angular JS

查看:83
本文介绍了Angular JS中的重复http帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Angularjs中的$ http帖子有疑问。任何人都可以帮助如何避免重复的请求...这是我在控制器中的代码





I have a problem with $http post in Angularjs. Any one can help on how to avoid duplicated requests... Here is my code in controller


var myApp = angular.module("myApp", ['ngRoute', 'pascalprecht.translate']);
myApp.controller('mainController', function ($scope, $translate, $location, $rootScope, $http, $filter, $interval) {
var myInit = function () {
            $http.post("API_V1/api.asmx/fetchALLRate", { data: {} })
                  .success(function (data, status, headers, config) {
                   this.objRate = $.parseJSON(data.d);
                   //do something...
            });
        };
angular.element(document).ready(myInit);





这里是重复请求错误的图片

http://i.stack.img ur.com/5fEyy.png [^]



提前谢谢..希望有人能帮助我...顺便说一句,对不起我的英语不好。 Angularjs中的



And here is image for duplicate request error
http://i.stack.imgur.com/5fEyy.png[^]

Thank you in advance.. hope that anyone could help me out...btw, sorry for my bad english.

推荐答案

http帖子。任何人都可以帮助如何避免重复的请求...这是我在控制器中的代码





http post in Angularjs. Any one can help on how to avoid duplicated requests... Here is my code in controller


var myApp = angular.module("myApp", ['ngRoute', 'pascalprecht.translate']);
myApp.controller('mainController', function (


范围,


翻译,


这篇关于Angular JS中的重复http帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆