How to disable caching with HttpClient get in Angular 6

后端 未结 4 1177
感动是毒
感动是毒 2020-12-09 16:52

I\'m writing an Angular SPA app, that uses HttpClient to get values from my backend.

What is the easy way to tell it not to cache? The first time I ask it gets the v

4条回答
  •  余生分开走
    2020-12-09 17:18

    Using meta HTML tags, Disable browser caching:-

    
    
    
    

    or,

    Add headers in http request as:-

    headers = new Headers({
            'Cache-Control':  'no-cache, no-store, must-revalidate, post- 
                                check=0, pre-check=0',
            'Pragma': 'no-cache',
            'Expires': '0'
        });
    

提交回复
热议问题