you can your parameters in config with:
$httpProvider.defaults.headers.common[*'Auth-Token'*] = *'SomeValue'*;
no need to use an interceptor.
Then in your controller you can manually override the defaults for the
individual request.
On Saturday, January 11, 2014 10:59:16 PM UTC-8, Rushikesh Remane wrote:
>
> Hi,
> Does any one have any solution for this.
>
> Replies appreciated.
>
> On Tuesday, November 26, 2013 4:12:56 PM UTC+5:30, Rushikesh Remane wrote:
>>
>> *Case : *
>> I have a request interceptor implemented that works as a service. The
>> functionality of its is to supply every request with authentication token.
>> myApp.factory('httpRequestInterceptor', function () {
>> return {
>> request: function (config) {
>> * config.headers['Auth-Token'] = 'SomeValue';*
>> return config;
>> }
>> };
>> });
>>
>> myApp.config(function ($httpProvider) {
>> $httpProvider.interceptors.push('httpRequestInterceptor');
>> });
>>
>>
>> Now every time I make some $http requests, it adds to the reqest header
>> and every thing works just perfect.
>>
>> *Problem : *
>>
>> I am making $http calls from a controller. Now the authentication token
>> will be passed to me from calling application which invokes this UI page. I
>> want to have provision where I can catch the incoming parameters from the
>> invoking application and use the passed parameter to the interceptor
>> service. In short I want to pass a value from my controller to the
>> 'httpRequestInterceptor'.
>>
>> Note that I don't have any control over invoking application.
>>
>> Please let me know how do I achieve this.
>>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.