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';
};
}