I am doing an angular project,but after every changes in java-script file I want to clear the cache.So I want to know is there any angular code for deleting or removing the cache file?
5 Answers
Just move ahead with the following command
npm cache clear --force
For verifying, you can run the following command to check the contents of the cache folder, garbage collecting any unneeded data, and verifying the integrity of the cache index and all cached data.
npm cache verify
3 Comments
Basil
A question can have multiple answers even though it was same. It's all about how it is being explained.
Vega
That's why we have the edit button. If you you think you can enrich the given answer, then make a suggestion. That's how SO works
Basil
That's your way of approach, What I did was elaborated the answer in my own way and made simple
How about adding this tag to index.html ? Is this valid?
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
1 Comment
Alec
This works for HTML changes that don't appear until after clearing cache. Here's a great article that explains it well: "For a single-page web application like Angular, index.html is like a gate for everything else. In Angular and almost all the other single-page web applications, routing happens in the front-end. Basically, by loading index.html, we are loading all the other pages too (If not lazy-load). Hence, If index.html is cached, then every other page is cached as well." yuezhizizhang.github.io/angular6/cache-control/2019/06/07/…