In this post, you will learn about steps that are required to create a progressive web app (PWA) with Angular 6. Unlike Angular 4 and Angular 5, it is very easy and quick with Angular 6. Just one command and you are done.
The following are the steps required to create PWA with Angular 6.
- Create an angular app using the following command:
ng new ProjectName
- Go to the root folder, (ProjectName). Execute the following command:
ng add @angular/pwa
The above command does some of the following:
- Adds the @angular/service-worker package
- Enables service worker to build support in the CLI. Imports and registers the service worker in the app module.
- Creates the service worker configuration file called ngsw-config.json.
- Updates the index.html with entries for manifest.json and meta-tags for the theme
- With Angular 4 and 5, one required to manually create and install icon files. With above command, it is done automatically.
- Build the project using the following command:
ng build --prod
- Time to test. Install http-server using the following command:
npm i http-server
- Go to dist folder and execute the following command:
http-server -p 8080
Open the Chrome Browser and test the PWA aspect using Lighthouse plugin.
- Getting started with service workers
- How to create PWA using Angular 5
- How to create PWA using Angular 4
In this post, you learned about how to create progressive web app (PWA) using Angular 6.
Did you find this article useful? Do you have any questions or suggestions about this article? Leave a comment and ask your questions and I shall do my best to address your queries.
He has also authored the book, Building Web Apps with Spring 5 and Angular.
Latest posts by Ajitesh Kumar (see all)
- DevOps Architect Interview Questions & Answers - October 18, 2018
- How to Start DevOps or DevSecOps in your Organization - October 18, 2018
- Data Science Team Structure – Roles & Responsibilities - October 17, 2018