0

I have developed an application in Angular 7. It is working perfectly fine in chrome and mozilla but specifically in IE 11, the page is getting routed back. Once I open developer tools on IE 11 it works fine. I am not getting the issue. Can someone please help. I have written below code in my ajx.service.ts too.

private _request(method: RequestMethod, url: string, body?: any, options?: RequestOptionsArgs, params?: RequestParams): Rx.Observable<Response> {
if (this.isIE) {
      requestOptions.headers.set('Cache-Control', 'no-cache');
      requestOptions.headers.set('Pragma', 'no-cache');
      requestOptions.headers.set('Expires', 'Sat, 01 Jan 2000 00:00:00 GMT');
      requestOptions.headers.set('If-Modified-Since', '0');
    }
}
  • As far as I know, `headers` is immutable, so you would have to assign your `set(....)`. See if you can apply it like so: `requestOptions.headers = requestOptions.headers.set('Cache-Control', 'no-cache');` And then for every line. – Silvermind Dec 10 '19 at 09:49
  • Hi @Silvermind. I am getting error type void is not assignable to type headers. – Zinkal Thakker Dec 10 '19 at 09:53
  • Can you create a simple Stackblitz example demonstrating the problem? – Silvermind Dec 10 '19 at 09:55
  • `RequestOptionsArgs` seems to be archived. Setting headers is done differently now. Have you checked out the current documentation of `HttpClient`? – Silvermind Dec 10 '19 at 10:00
  • Please check your code, whether you might have some debugging code in your javascript? Besides, can debug your code and find out which line of code will show the error? It is better to post the Enough code to reproduce the problem as in [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Zhi Lv Dec 10 '19 at 13:22

0 Answers0