Javascript 如何清除angularjs中的缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36985240/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 19:47:29  来源:igfitidea点击:

How to clear the cache in angularjs

javascriptangularjs

提问by ArunJaganathan

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?

我正在做一个 angular 项目,但是在每次更改 java-script 文件后我想清除缓存。所以我想知道是否有任何用于删除或删除缓存文件的 angular 代码?

回答by etah jet

just do this npm cache clear --forceit will work

只要这样做npm cache clear --force它就会工作

回答by Carlos Cruz

How about adding this tag to index.html ? Is this valid?

将此标签添加到 index.html 怎么样?这是有效的吗?

<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" /> 

回答by Basil Mohammed

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

回答by Fahim zuhair

first

第一的

npm cache clear --force

then

然后

npm cache verify