XMLHttpRequest cannot load 'URL'. Response for preflight has invalid HTTP status code 401
<p>I work on ionic. and got this error. Here are my app.js:</p>

<pre><code>var app = angular.module('eMoMo', ['ionic', 'ngCordova'])
.config(['$httpProvider', function ($httpProvider) {
       //Reset headers to avoid OPTIONS request (aka preflight)
       $httpProvider.defaults.headers.common = {};
       $httpProvider.defaults.headers.post = {};
       $httpProvider.defaults.headers.get = {};
       $httpProvider.defaults.headers.delete = {};
       $httpProvider.defaults.headers.put = {};
       $httpProvider.defaults.headers.patch = {};
       $httpProvider.defaults.headers.common['Access-Control-Allow-Headers'] = '*';                                     
       //$httpProvider.defaults.headers.common['Authorization'] = 'Basic ' + btoa(my_id+ ':' + my_pass")
   }]);

app.controller('MainViewController',  function($scope, $http) {
  $http({
    method:"GET",
    url: "my_url"
      headers: {
        'content-type': 'application/x-www-form-urlencoded; charset=utf-8',
        'authorization': 'Basic ' + btoa('my_username' + ':' + 'my_pass')
        'access-control-allow-origin': '*'
    }
  }).then(function(categories){
    console.log(categories);
  });

});

app.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
}
</code></pre>

<p>)</p>

<p>I try to research, it is relate about CORS but I have install an plugin to chrome to disable that error. How can I solve this problem. ?</p>