如何通过使用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从应用程序发出请求