Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular$http错误函数从未为127.0.0.1调用_Http_Angularjs - Fatal编程技术网

Angular$http错误函数从未为127.0.0.1调用

Angular$http错误函数从未为127.0.0.1调用,http,angularjs,Http,Angularjs,我使用角度版本: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> 我没有在端口10880上运行任何东西。如果我在$http.get函数中使用127.0.0.1,则从未调用过error。但如果使用localhost而不是127.0.0.1,则会调用错误函数。我不是舒尔,这根本就是角度问题。我使用Linux 谢谢你的建议 Zlaja如果在

我使用角度版本:

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
我没有在端口10880上运行任何东西。如果我在$http.get函数中使用127.0.0.1,则从未调用过error。但如果使用localhost而不是127.0.0.1,则会调用错误函数。我不是舒尔,这根本就是角度问题。我使用Linux

谢谢你的建议


Zlaja

如果在
127.0.0.1:xxxx
之前添加
http://
,它应该可以工作


我没有更多的解释。我正在尝试从$http服务的源中查找相关内容。

您是否在调试器的“网络”选项卡上看到127.0.0.1:10880上的传出请求?否,没有传出请求
function HelloController($scope,$http) {
    $scope.greeting = {
        text : 'Hello'
    };

    $scope.clickMe = function() {
        $http.get('127.0.0.1:10880', {params: {tsn:'10'}})
             .success(function(data,status,header,config) {
                 $scope.greeting.text ='This is cool';
             }).error(function(data,status,header,config) {
                 $scope.greeting.text ='We have error';
             });    

        $scope.greeting.text ='None';
    };
}