如何防止在Office任务窗格应用程序中缓存AngularJs视图

如何防止在Office任务窗格应用程序中缓存AngularJs视图,angularjs,caching,office-app,apps-for-office,Angularjs,Caching,Office App,Apps For Office,我正在AngularJs中构建一个Office Web应用程序,我的视图正在被缓存,我正在尝试解决如何防止缓存我的AngularJs视图 对Index.html文件和as*.js的更改会反映在选项卡窗格中,但视图中的任何更改都不会反映出来。以下是一些不起作用的事情: 将以下内容添加到index.html的标题中: <meta http-equiv="cache-control" content="no-store"> <meta http-equiv="cache-contro

我正在AngularJs中构建一个Office Web应用程序,我的视图正在被缓存,我正在尝试解决如何防止缓存我的AngularJs视图

对Index.html文件和as*.js的更改会反映在选项卡窗格中,但视图中的任何更改都不会反映出来。以下是一些不起作用的事情:

将以下内容添加到index.html的标题中:

<meta http-equiv="cache-control" content="no-store">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
将此添加到web.config:

  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="DisableCache" />
    </staticContent>
  </system.webServer>

唯一有效的方法就是重命名视图


单独使用时,Chrome、Firefox甚至IE中都不会出现缓存。

这可以通过ng include标记中的简单查询字符串来解决,如中所述(但在本例中也适用于Angular)

因此,在我的Office任务窗格应用程序中,我有一个
ng include=“'partials/allhtml.html'”
并将其更改为
ng include=“'partials/allhtml.html?v=1.0.1'”
,解决了缓存问题


如链接中所述,您无需每次更改?v的值;只要您有一个查询字符串,那么http get就不会被缓存

您也可以试试这个
$templateCache.removeAll()关于路线更改too@pankajparkar你在($routeChangeStart')上给我留言了吗?做了那件事tooYaa.那有什么影响吗?@pankajparkar没有,不幸的是。
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="DisableCache" />
    </staticContent>
  </system.webServer>