title: No 'Access-Control-Allow-Origin' header is present on the requested resource- AngularJS
body: <pre><code>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.
  </code></pre>
  
  <p>I get this error when I try to run my web-service from inside my code. I tried finding about it and tried many solutions which were suggested which I found on net. Pasting the code below.</p>
  
  <pre><code>&lt;form name="LoginForm" ng-controller="LoginCtrl" ng-submit="init(username,password,country)"&gt;
      &lt;label&gt;Country&lt;/label&gt;&lt;input type="text" ng-model="country"/&gt;&lt;br/&gt;&lt;br/&gt;
      &lt;label&gt;UserName&lt;/label&gt;&lt;input type="text" ng-model="username" /&gt;&lt;/br&gt;&lt;/br&gt;
      &lt;label&gt;Password&lt;/label&gt;&lt;input type="password" ng-model="password"&gt;
      &lt;/br&gt;
      &lt;button type="submit" &gt;Login&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And controller form the corresponding js is: </p>
  
  <pre><code>app.controller('LoginController', ['$http', '$scope', function ($scope, $http) {
      $scope.login = function (credentials) {
      $http.get('http://mywebservice').success(function ( data ) {
          alert(data);
          });
      }
  }]);
  </code></pre>
  
  <p>The web-service works fine when I hit it from URL bar. How to resolve the problem? Kindly help!</p>