Progressive Web Apps (PWAs) bring the best of web and mobile together — offering offline capability, push notifications, and lightning-fast load times. For modern business applications built with Angular, enabling PWA features can dramatically improve user experience, engagement, and reliability, especially in low-network conditions.
1. What is a Progressive Web App (PWA)?
A PWA is a web application that uses modern web APIs and best practices to deliver an experience comparable to native mobile apps.
It can be installed on a device, works offline, and loads instantly, even on flaky networks.
Key Features
Works offline with cached assets and data
Can be installed to home screen
Offers push notifications
Uses HTTPS for security
Provides app-like performance
2. Why PWAs are Perfect for Business Apps
Businesses rely on reliability, scalability, and accessibility. PWAs offer all three by:
Reducing bounce rates with faster load times.
Increasing user engagement via push notifications.
Allowing access anywhere, even without internet.
Cutting costs compared to maintaining separate native apps.
For example, a field-service Angular app can still record tasks offline and sync them once back online — a huge productivity booster.
3. Setting Up a PWA in an Angular Project
Angular provides built-in PWA support through the @angular/pwa package.
Step 1: Install PWA Support
ng add @angular/pwa
This command automatically:
Adds a service worker (ngsw-worker.js)
Updates the manifest.webmanifest
Adds PWA configurations in angular.json
Step 2: Configure manifest.webmanifest
Your manifest.webmanifest defines how the app behaves when installed.
Example
{
"name": "SilverXis Business App",
"short_name": "SilverXis",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"start_url": "/",
"icons": [
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
Step 3: Build the App with Service Worker
ng build --configuration production
Angular’s production configuration automatically registers the service worker and caches your assets and routes.
4. Making Your App Work Offline
Angular Service Workers handle offline caching using ngsw-config.json.
Here’s an example configuration:
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": ["/favicon.ico", "/*.css", "/*.js"]
}
},
{
"name": "assets",
"installMode": "lazy",
"resources": {
"files": ["/assets/**"]
}
}
]
}
This setup ensures:
5. Handling Dynamic Data Offline
For business applications that rely on APIs, you can use IndexedDB or localStorage to store API responses.
Example using IndexedDB via idb package
npm install idb
import { openDB } from 'idb';
async function saveCustomerData(data: any[]) {
const db = await openDB('businessAppDB', 1, {
upgrade(db) {
db.createObjectStore('customers');
}
});
await db.put('customers', data, 'list');
}
async function getCustomerData() {
const db = await openDB('businessAppDB', 1);
return await db.get('customers', 'list');
}
This ensures your Angular app continues to show cached customer data even when offline.
6. Enabling Push Notifications
Add Firebase Cloud Messaging (FCM) or Azure Notification Hub for push notifications.
Example (Firebase)
import { AngularFireMessaging } from '@angular/fire/compat/messaging';
constructor(private afMessaging: AngularFireMessaging) {
this.afMessaging.requestPermission.subscribe(
() => this.afMessaging.getToken.subscribe(token => console.log('FCM Token:', token))
);
}
Push notifications can alert users about new approvals, messages, or status updates — boosting real-time engagement.
7. Deploying and Testing the PWA
Deploy your built app to a secure server (HTTPS required).
To test the PWA:
Open Chrome DevTools → Application → Manifest
Click “Add to Home Screen”
Simulate offline mode to verify caching behavior
8. Bonus: Update Strategy
Angular’s service worker automatically updates when you deploy a new version.
To notify users about updates:
import { SwUpdate } from '@angular/service-worker';
constructor(private updates: SwUpdate) {
this.updates.available.subscribe(() => {
if (confirm('New version available. Load it?')) {
window.location.reload();
}
});
}
9. Real-World Example
Imagine an Inventory Management App for warehouse staff:
Loads critical data once and works offline during inventory scans.
Syncs records automatically when online.
Provides push alerts for low stock or new shipments.
With Angular PWA, all this works seamlessly — no native app required.
10. Conclusion
PWAs empower Angular business apps to deliver consistent, high-quality user experiences — online or offline.
By leveraging service workers, offline caching, and push notifications, businesses can ensure their web apps remain fast, installable, and reliable.
If you’re building enterprise-grade solutions in Angular, enabling PWA features is no longer optional — it’s a strategic advantage.