我正在使用一个样本,该样本将使用Angular和Breezejs显示来自OData的内容
的index.html
<!docttype html>
<html ng-app="app">
<head>
<script src="datajs-1.0.3.js"></script>
</head>
<body>
<div ng-controller="LearnCtrl">
<p ng-show="!results">Fetching...</p>
<li ng-show="results" ng-repeat="result in results">
<span>{{result.Login}}</span>
<span>{{result.Email}}</span>
</li>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.js"></script>
<script src="http://sampleservice.breezejs.com/scripts/q.min.js"></script>
<script src="http://sampleservice.breezejs.com/scripts/breeze.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<script src="app.js"></script>
</body>
</html>
app.js
var app = angular.module('app', []);
breeze.config.initializeAdapterInstance("dataService", "OData");
breeze.config.initializeAdapterInstance("modelLibrary", "backingStore", true);
app.controller("LearnCtrl", function($scope) {
var manager = new breeze.EntityManager('http://localhost:8083/WordPress2.svc');
var query = new breeze.EntityQuery()
.from("User");
manager.executeQuery(query).then(function(data){
$scope.results = data.results;
$scope.$apply();
}).fail(function(e) {
alert(e);
});
});
我正在使用ISS7服务器执行代码... 当我说localhost:8082 ...在console.log中它说
OPTIONS http://localhost:8083/WordPress2.svc/$metadata 501 (Not Implemented) datajs-1.0.3.js:1074
OPTIONS http://localhost:8083/WordPress2.svc/$metadata Origin http://localhost:8082 is not allowed by Access-Control-Allow-Origin. datajs-1.0.3.js:1074
XMLHttpRequest cannot load http://localhost:8083/WordPress2.svc/$metadata. Origin http://localhost:8082 is not allowed by Access-Control-Allow-Origin. localhost/:1
应为空:[] 为什么我收到这个错误... PLZ帮帮我......这是我第一个使用这些技术的应用......