Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过使用Angular Service Worker从服务器获取的动态版本控制缓存.json文件_Angular_Typescript_Service Worker_Angular Service Worker_Ngsw Config - Fatal编程技术网

如何通过使用Angular Service Worker从服务器获取的动态版本控制缓存.json文件

如何通过使用Angular Service Worker从服务器获取的动态版本控制缓存.json文件,angular,typescript,service-worker,angular-service-worker,ngsw-config,Angular,Typescript,Service Worker,Angular Service Worker,Ngsw Config,我正在尝试从https://xxxxx.com/config.json?v={xxxxxxxx}使用角度维修工。我的ngsw config.json如下所示: { "$schema": "./node_modules/@angular/service-worker/config/schema.json", "index": "/index.html", "assetGroups": [

我正在尝试从
https://xxxxx.com/config.json?v={xxxxxxxx}
使用角度维修工。我的
ngsw config.json
如下所示:

{
  "$schema": "./node_modules/@angular/service-worker/config/schema.json",
  "index": "/index.html",
  "assetGroups": [
    {
      "name": "app",
      "installMode": "prefetch",
      "resources": {
        "files": [
          "/favicon.ico",
          "/index.html",
          "/manifest.webmanifest",
          "/*.css",
          "/*.js",
          "/*.json"
        ],
        "urls": [
            "https://xxxxx.com/static/atomic/buildcss/fonts-com.css",
            "https://xxxxx.com/static/atomic/images/logos/**",
            "https://xxxxx.com/static/atomic/fonts/adj-icons/**",
            "https://xxxxx.com/static/atomic/fonts/adj-fonts/**",
            "https://xxxxx.com/static/atomic/icons/**"
          ]
      }
    },
    {
      "name": "assets",
      "installMode": "lazy",
      "updateMode": "prefetch",
      "resources": {
        "files": [
          "/assets/**",
          "/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani|json)"
        ],
        "urls": [
          "https://xxxxx.com/static/**"
        ]
      }
    }
  ],
  "dataGroups": [
    {
      "name": "static",
      "urls": [
        "https://xxxxx.com/static/**"
      ],
      "cacheConfig": {
        "maxSize": 7,
        "maxAge": "1d",
        "strategy": "freshness"
      }
    }
  ]
}
我试图通过
数据组
资产组
获取它,但它们都不工作

有什么建议吗

我应该在资产中使用此URL,因为.json是从服务器获取的文件,还是应该在数据组中使用它?beqause im从应用程序发出请求