所请求的资源上没有“ Access-Control-Allow-Origin”标头-AngularJS
XMLHttpRequest cannot load http://mywebservice. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. 当我尝试从代码内部运行Web服务时,出现此错误。我尝试找到有关它,并尝试了许多在网上找到的建议解决方案。粘贴下面的代码。 <form name="LoginForm" ng-controller="LoginCtrl" ng-submit="init(username,password,country)"> <label>Country</label><input type="text" ng-model="country"/><br/><br/> <label>UserName</label><input type="text" ng-model="username" /></br></br> <label>Password</label><input type="password" ng-model="password"> </br> <button type="submit" >Login</button> </form> 与控制器对应的js形式为: app.controller('LoginController', ['$http', '$scope', function ($scope, $http) { $scope.login = …