这本书首先让让我在localhost:5000上启动了一个服务,然后又在localhost:5500上启动了一个存储数据的服务器,最后在localhost:5000下的页面中用请求5500上的数据,可是这尼玛分明跨域了啊,然后书里面没有给出任何提示和讲解,作者有病吗?我怕我会砍死他!!!
最后,请求大家教教我怎么解决?
angular.module('sportsStrore').constant("dataUrl", "http://localhost:5500/products").controller('sportsStoreCtrl', function($scope, $http, dadaUrl){
$scope.data = {};
$http.get(dataUrl).success(function(data){
$scope.data.product = data;
});
});
你们让我加的那个头我不知道怎么加上去,因为我那个被请求的服务器是这样在终端启动的,
dpd create sportsstore
dpd -p 5500 sportsstore/app.dpd
dashboard
就这样,被请求的服务就会弹出管理页面,加哪里呢?
去npm上看看这个模块cors,cors