Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. $http.defaults.headers.common['Auth-Token'] = 'token';
  2.  
  3. $http.defaults.headers.common['Authentication'] = 'authentication';
  4.  
  5. myapp.factory('httpRequestInterceptor', function () {
  6. return {
  7. request: function (config) {
  8.  
  9. // use this to destroying other existing headers
  10. config.headers = {'Authentication':'authentication'}
  11.  
  12. // use this to prevent destroying other existing headers
  13. // config.headers['Authorization'] = 'authentication;
  14.  
  15. return config;
  16. }
  17. };
  18. });
  19.  
  20. myapp.config(function ($httpProvider) {
  21. $httpProvider.interceptors.push('httpRequestInterceptor');
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement