title: How to enable CORS in AngularJs
body: <p>I have created a demo using JavaScript for Flickr photo search API. 
  Now I am converting it to the AngularJs.
  I have searched on internet and found below configuration. </p>
  
  <p>Configuration:</p>
  
  <pre><code>myApp.config(function($httpProvider) {
    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
  });
  </code></pre>
  
  <p>Service:</p>
  
  <pre><code>myApp.service('dataService', function($http) {
      delete $http.defaults.headers.common['X-Requested-With'];
      this.flickrPhotoSearch = function() {
          return $http({
              method: 'GET',
              url: 'http://api.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=3f807259749363aaa29c76012fa93945&amp;tags=india&amp;format=json&amp;callback=?',
              dataType: 'jsonp',
              headers: {'Authorization': 'Token token=xxxxYYYYZzzz'}
           });
       }
  });
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>myApp.controller('flickrController', function($scope, dataService) {
          $scope.data = null;
          dataService.flickrPhotoSearch().then(function(dataResponse) {
              $scope.data = dataResponse;
              console.log($scope.data);
          });
      });
  </code></pre>
  
  <p>But still I got the same error.
  Here are some links I tried:</p>
  
  <p><a href="http://stackoverflow.com/q/18733104/3115091">XMLHttpRequest cannot load URL. Origin not allowed by Access-Control-Allow-Origin</a></p>
  
  <p><a href="http://goo.gl/JuS5B1" rel="noreferrer">http://goo.gl/JuS5B1</a></p>