I had the same problem and decided to use it:
myApp.config(['$httpProvider', function($httpProvider) { $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; }]);
You can also set a header for accepting application/json :
$http({ method: 'GET', url: '/someUrl', headers: { Accept: 'application/json' } })
Mustafa Dwekat Mar 10 '16 at 15:11 2016-03-10 15:11
source share