Explain how interceptors work with $http requests in AngularJS.

Interceptors intercept and modify HTTP requests or responses. They’re used for tasks like adding headers, handling errors, or logging.

$httpProvider.interceptors.push('myInterceptor');