I am currently working on developing an Angular application that utilizes $routeProvider. The backend of the application is built using .NET, which serves HTML files tailored with specific permissions and roles for my app. Occasionally, when a certain action is triggered, the backend will make a RedirectToAction call resulting in a 302 HTTP status code redirect to another URL. As a result, the templateUrl defined within the router receives a different HTML file intended for that route. I need to find a way to intercept this 302 HTTP response and adjust the route accordingly, possibly by switching to a different controller.
The optimal solution would involve modifying the backend to handle API requests that could determine if redirection is necessary. However, in cases where making changes to the backend is not feasible, what alternative options can be considered?
Initially, I attempted to implement an interceptor within the $httpProvider, but found that the response only contained an HTTP 200 status code and data from the redirected site.