如何清除angularjs中的缓存

How to clear the cache in angularjs

本文关键字:angularjs 缓存 清除 何清除      更新时间:2023-09-26

我正在做一个有角度的项目,但在java脚本文件中的每次更改之后,我都想清除缓存。所以我想知道是否有任何角度代码可以删除或删除缓存文件?

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

只需执行以下命令

npm cache clear --force

为了进行验证,您可以运行以下命令来检查缓存文件夹的内容,垃圾收集任何不需要的数据,并验证缓存索引和所有缓存数据的完整性。

npm cache verify

第一个

npm cache clear --force

然后

npm cache verify

把这个标签添加到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" /> 

第1步:

npm cache clear --force

第2步:

npm cache verify