I am working on a sample application using ASP.NET MVC and AngularJS.
In server side code , I have written a Action filter attribute , and in that I need to check whethe
It decides by looking whether X-Requested-With
header exists or not.
You can add X-Request-With
header manually to $http
service.
Individual request
$http.get('/controller/action', {
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
});
For every request
app.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';
}]);
You can see why it is missing from Angular