当我在javascript中包含todos.json文件时,它显示此错误。 我使用的浏览器是firefox,在chrome中显示它只支持协议方案的交叉源请求:http,数据,chrome,chrome-extension,https,chrome-extension-resource。 firefox中的错误低于
Error: Access to restricted URI denied
fg/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:99:1
r@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:95:367
m/g<@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:93:8
e/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:126:404
uf/this.$get</m.prototype.$eval@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:141:43
uf/this.$get</m.prototype.$digest@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:138:132
uf/this.$get</m.prototype.$apply@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:141:339
Ac/c/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:21:42
h/<.invoke@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:41:293
Ac/c@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:20:1
Ac@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:21:259
fe@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:20:69
@https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js:306:372
m.Callbacks/j@https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:2:27304
m.Callbacks/k.fireWith@https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:2:28122
.ready@https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:2:29954
J@https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js:2:30320
var App = angular.module('App', []);
App.controller('TodoCtrl', function($scope, $http) {
$http.get('../todos.json')
.then(function(res) {
$scope.todos = res.data;
});
});
&#13;
<!DOCTYPE html>
<html lang="en">
<head>
<!-- all the script and javascript file are included-->
</head>
<title>Discussion</title>
<body ng-app="App">
<div ng-controller="TodoCtrl">
<ul>
<li ng-repeat="todo in todos">
{{todo.text}} - <em>{{todo.done}}</em>
</li>
</ul>
</div>
</body>
</html>
&#13;