Hi I need to change http headers from inside a controller. It works in config by using $httpProvider but thats not what I am looking for.
I tried this but it says push of undefined.
$http.interceptors.push([function() {
return {
'request': function(config) {
config.headers = config.headers || {};
//add nonce to avoid CSRF issues
config.headers['X-WP-Nonce'] = myLocalized.nonce;
return config;
}
};
}]);