我无法通过角度服务工作者缓存我的主数据 api 大多数示例显示 dataGroup 中的 url 在同一域上,因此只有“/目录”有效,但我的 api 托管在另一个域上
可以说它在 http://x.com/api/catalog
以下是 ngsw-config.json
{
"index": "/index.html",
"assetGroups": [{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html"
],
"versionedFiles": [
"/*.bundle.css",
"/*.bundle.js",
"/*.chunk.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
],
"urls": [
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
]
}
}],
"dataGroups": [{
"name": "xyz",
"urls": ["http://x.com/api/catalog"],
"cacheConfig": {
"strategy": "freshness",
"maxSize": 15,
"maxAge": "1h",
"timeout": "5s"
}
}]
}