为什么下面的代码运行没有状态的错误回调?Firefox 中的 Web Developer 报告状态代码 200。
有没有办法调试这个?
<meta charset="utf8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script type="text/javascript">
function RoomListCtrl($scope, $http) {
$scope.getRooms = function() {
$http({method: 'GET', url: 'http://code.angularjs.org'}).
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
alert('succes');
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
alert('error');
});
}
$scope.submit = function() {
this.getRooms();
}
}
</script>
<body ng-controller="RoomListCtrl"><form ng-submit="submit()">
<input type="text" value="" ng-model="search" name="search" >
</form></body>