How to set headers for every request in angular?



How to set headers for every request in angular?..

Answer / Gopal Saha

To set headers for every request in Angular, you can use interceptors provided by Angular HttpClient. You need to create a custom interceptor class and implement the `intercept` method. In this method, you can add the desired headers to the HTTP request.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

How to upgrade angular 7 to 8?

2 Answers  


What is component in angularjs 2 ?

1 Answers  


How can you create singleton service in angular 2?

1 Answers  


What is directive?

1 Answers  


How AngularJS handle data binding?

1 Answers  


What are the purpose of @ngmodule?

1 Answers  


Why to use “$http” in AngularJS?

1 Answers  


What is scope emit?

1 Answers  


How to setup angular 4 development environment?

1 Answers  


What is meant by decorator in angular?

1 Answers  


What is chaining pipe?

1 Answers  


Give the example of angularjs object?

1 Answers  


Categories