title: AngularJS: No "Access-Control-Allow-Origin" header is present on the requested resource
body: <p>I'm writting my webApp and I'm using AngularJS. In this app I have created a file called script.js and I report this code:</p>
  
  <pre><code>var modulo = angular.module('progetto', ['ngRoute']);
  
      // configure our routes
      modulo.config(function ($routeProvider, $httpProvider) {
          $routeProvider
  
              // route for the home page
              .when('/', {
                  templateUrl: 'listaFilm.html',
                  controller: 'listaController'
              })
  
              // route for the description page
              .when('/:phoneName', {
                  templateUrl: 'description.html',
                  controller: 'descriptionController'
              });
  
  
              $httpProvider.defaults.headers.common['Access-Control-Allow-Origin'] = '*';
  
      });
  
  
      modulo.controller('listaController', function ($scope, $http) {
          $http.get('https://api.getevents.co/event?&amp;lat=41.904196&amp;lng=12.465974').success(function (data) {
              $scope.names = data;
              }).
              error(function (data, status) {
                  $scope.names = "Request failed";
              });
      });
  </code></pre>
  
  <p>With this code I call API following RESTful principles. When I run the code i have this problem:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="https://api.getevents.co" rel="noreferrer">https://api.getevents.co</a> No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://localhost:8383" rel="noreferrer">http://localhost:8383</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>Reading on the web I understood that I have a problem called CORS...I have tried several solutions proposed but I didn't resolve the problem.<br>
  How can I fix the problem?<br>
  What's the code that I must add for fix it?</p>