I use Angular version:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
This is my controller:
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';
};
}
I have nothing running on port 10880. If I use 127.0.0.1 in $http.get function error has never called. But if I use localhost insted of 127.0.0.1 error function gets called. I am not shure is this Angular problem at all. I use Linux.
Thanks for any idea
Zlaja
If you add http://
before 127.0.0.1:xxxx
it should work.
I don't have more explanation why. I'm trying to find something relevent from the source of $http service.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.