angular-service-worker

Angular Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script

霸气de小男生 提交于 2019-12-22 08:52:22
问题 I am doing Push notifications in Angular PWA with Firebase and I am following a link to do so. https://medium.com/@tariqueejaz/progressive-web-app-push-notifications-making-the-web-app-more-native-in-nature-a167af22e004 I am using Angular 6 and have setup the code for everything. when I am trying to run it, then it is showing me a pop up . After clicking on Allow button, it is throwing an error on console: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when

Angular Service Worker - dataGroups not working

荒凉一梦 提交于 2019-12-22 05:20:09
问题 I'm trying to use Angular Service Worker, everything works fine except the dataGroups not working for me. that's what I have in my ngsw-config.json : "dataGroups": [ { "name": "api-performance", "urls": [ "/shipments/**" ], "cacheConfig": { "strategy": "performance", "maxSize": 100, "maxAge": "3d" } } ] In my network tab I see that the service worker always make the server call then falls back to the cache. see attached image. dataGroups - Performance Notice the API I'm calling are on a

Angular 7 - Service Worker PWA + SSR not working on server

青春壹個敷衍的年華 提交于 2019-12-22 04:30:23
问题 I am struggling to make my Server Side Rendering and Service Worker cooperate on server Side. Information regarding localhost -> Working This is working as expected. The service worker works and updates my app on every update. Moreover; a curl localhost:8082 send me back my info. I start my app with the following command : npm run ssr "ssr": "npm run build:ssr && npm run serve:ssr", "build:ssr": "npm run build:client-and-server-bundles", "serve:ssr": "node dist/server.js", "build:client-and

Angular 5 Service Worker not working

╄→гoц情女王★ 提交于 2019-12-22 03:09:28
问题 I try to add service worker to my project after updating to angular 5 and have some problems. I add imports to app.module.ts: import {ServiceWorkerModule} from '@angular/service-worker'; import {environment} from '../environments/environment'; ... environment.production ? ServiceWorkerModule.register('/ngsw-worker.js') : [], execute $ ng set apps.0.serviceWorker=true to allow service workers in project generate config: { "index": "/index.html", "assetGroups": [ { "name": "app", "installMode":

Angular Service Worker on the browsers that do not support it

倖福魔咒の 提交于 2019-12-21 17:51:52
问题 Angular team made a great job and introduced service workers support in the version 5. The documentation is quite helpful and I can really see how the things will work right after reading the related articles, however there is one topic that is not covered there. How does this all work in the browsers that do not support service workers. This is what's being said: Your application must run in a web browser that supports service workers. Currently, the latest versions of Chrome and Firefox are

Angular Service Worker - Failed to load resource: the server responded with a status of 504 (Gateway Timeout)

时间秒杀一切 提交于 2019-12-20 09:46:40
问题 I am using the Angular-CLI 1.6.6 and @angular/service-worker 5.2.5 in our Angular 5.2.5 app. Everything works fine on the local lite-server, as well as on the production server, except for one error message popping in our production environment: Failed to load resource: the server responded with a status of 504 (Gateway Timeout) Looking into the ngsw-worker.js script I found the lines (2466 following) where the error message above is generated: async safeFetch(req) { try { return await this

How to handle routing in Angular 5+ Service Workers?

一世执手 提交于 2019-12-20 08:13:20
问题 In previous versions of the Angular service worker implementation, one of the config options was "routing" . This can be seen in this unanswered SO question, was referenced in this Angular CLI issue, and the best remaining documentation seems to be the blog post by Stephen Fluin (on the Angular team), as well as the I/O talk from Alex Rickabaugh (from Google). With Angular 5, the ServiceWorkerModule has been well built-out, and most of the configuration can now be handled using the ngsw

How to handle routing in Angular 5+ Service Workers?

谁说我不能喝 提交于 2019-12-20 08:12:23
问题 In previous versions of the Angular service worker implementation, one of the config options was "routing" . This can be seen in this unanswered SO question, was referenced in this Angular CLI issue, and the best remaining documentation seems to be the blog post by Stephen Fluin (on the Angular team), as well as the I/O talk from Alex Rickabaugh (from Google). With Angular 5, the ServiceWorkerModule has been well built-out, and most of the configuration can now be handled using the ngsw

angular service-worker - handling push notification click

杀马特。学长 韩版系。学妹 提交于 2019-12-19 19:40:37
问题 How do I handle the push notification click in angular service worker. The SWPush does not have any methods. I have tried referencing a js which listens to the "notificationclick" event handler but it never got fired on the click of the notification button. 回答1: Call SWPush#requestSubscription. Here's a good article 回答2: I had to update my package.json to: "@angular/service-worker": "7.1.0" then this worked for me: this.swPush.notificationClicks.subscribe((result) => { console.log('clicked',

Caching of index.html in Angular Service worker

陌路散爱 提交于 2019-12-19 02:30:10
问题 Everytime I make any change to the index.html with my angular project, Serviceworker never gets updated and always serves the old cached version on index.html. How do I fix this (Also, there is no caching at the server end as well as browser) Here is my ngsw-config file { "index": "/index.html", "assetGroups": [{ "name": "app", "installMode": "prefetch", "resources": { "files": [ "/favicon.ico", "/index.html", "/manifest.json" ], "versionedFiles": [ "/*.bundle.css", "/*.bundle.js", "/*.chunk