A Progressive Web App sample using @angular/service-worker
and ngx-onsenui
.
Try it here: https://puku0x.github.io/ngx-onsenui-pwa/.
- Node.js (v6 or later)
- Angular CLI
$ npm install
$ ng serve
The app will run at http://localhost:4200.
$ ng build --prod
- Create a new project.
$ ng new <App Name>
- Install
@angular/service-worker
.
$ npm install @angular/service-worker
-
Write your App.
-
Make a
manifest.json
. For example,
{
"short_name": "Sample",
"name": "Sample Application",
"icons": [
{
"src": "icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src":"icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
}
],
"start_url": "/index.html",
"background_color": "#f24235",
"theme_color": "#f44336",
"display": "standalone"
}
- Add a link to
manifest.json
inindex.html
<link rel="manifest" href="manifest.json">
- Add
manifest.json
toassets
in.angular-cli.json
.
{
"apps": [
{
...,
"assets": [
"assets",
"favicon.ico",
"manifest.json"
],
}
]
}
- Enable Service Worker in
.angular-cli.json
.
{
"apps": [
{
...,
"serviceWorker": true,
}
]
}
- Fork it ( https://github.com/puku0x/ngx-onsenui-pwa/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
- Progressive Web Apps using the Angular Service Worker by @webmaxru
- PWAs with the Angular CLI by @amcdn
- Angular PWA by @laco0416