我有一个单页 html 和 Angularjs 文件。
App.js
angular
.module('vod', [])
.controller('moviesController', ['$http', function ($http) {
var self = this;
self.movies = [];
$http.get('http://localhost:8080/movies/').then(function (response) {
self.movies = response.data;
}, function (errResponse) {
console.error('Error while fetching movies');
});
}]);
HTML
<!DOCTYPE html>
<html>
<head>
<title>Angular</title>
<script src="angular.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="moviesController as ctrl"
ng-app="vod">
<div ng-repeat="movie in ctrl.movies">
<span ng-bind="movie.title"></span>
</div>
</body>
</html>
它在 Chrome 上运行良好,可以生成电影标题,但会出现错误
SCRIPT7002:XMLHttpRequest:网络错误 0x2,系统找不到指定的文件
和
SCRIPT7002:XMLHttpRequest:网络错误 0x2efd,由于错误 00002efd,无法完成操作。
在 Microsoft Edge 上。
最佳答案
有几件事可能会出错。
尝试添加 Content-type: application/json; charset=utf-8
header 。
Edge 不喜欢 VPN 和混合网络。这对您来说可能不是这种情况,但很高兴知道。
更多阅读:
关于javascript - Microsoft Edge : XMLHttpRequest: Network Error 0x2efd, 由于错误 00002efd,无法完成操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40383565/