原子テキストエディタを試していますが、私はこの問題に直面しています。原子のanglejsからローカルpythonファイルを呼び出します。
私のコードは以下の通りです:
が、これはHTMLの角度のファイルtest.htmlという
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<ul>
<li ng-repeat="x in myData">
{{ x.name + ', ' + x.age }}
</li>
</ul>
</div>
</body>
</html>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get('test.py').then(function(response) {
$scope.myData = response.data;
});
});
</script>
とPythonのファイルtest.py私は開く
import json
test = [{'name':'sample1','age':'24'},{'name':'sample2','age':'25'}]
print json.dumps(test);
以下のようにされています原子でこのブラウザ、私は次のエラーが表示されます。
angular.js:10765 Failed to load file:///Users/harshajasti/Desktop/LibraryApplication/test.py: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
私はローカルファイルを呼び出すためにエラーが発生していますが、これを修正する方法はわかりません。
注:これは原子の問題ではありません。 – francium