I referred to many documents and articles also implemented them to make the PWA work offline. That is, it should save the data offline and when it is connected to the internet the app should store all the data in the server database. I have created a PWA app in Angular8+ with backend PHP and database MySQL. But it is not working offline. I have modified the ngsw-config.json file and added dataGroups to it.
"dataGroups": [
{
"name": "api-performance",
"urls": [
"/**" // "/**" for all urls
],
"cacheConfig": {
"strategy": "freshness",
"maxSize": 20,
"maxAge": "12h",
"timeout": "5s"
}
}
],
This is still not working completely as only a few PHP files are cached and data is retrieved when offline. Referred the below links:
https://www.geekstrick.com/angular-pwa-fast-offline-angular-9-application/
https://medium.com/jspoint/indexeddb-your-second-step-towards-progressive-web-apps-pwa-dcbcd6cc2076
What changes I can do in my code or add additional code to it? Is there any alternative way to achieve the target?