All i did was chnage the app.module.ts to this. Nothing else.
import {
NgModule
} from '@angular/core';
import {
BrowserModule
} from '@angular/platform-browser';
import {
FormsModule
} from '@angular/forms';
import {
HttpClientModule
} from '@angular/common/http';
import {
IonicModule
} from '@ionic/angular';
import {
IonicStorageModule
} from '@ionic/storage';
import {
ApperyioModule
} from './scripts/apperyio/apperyio.module';
import {
PipesModule
} from './scripts/pipes.module';
import {
DirectivesModule
} from './scripts/directives.module';
import {
ComponentsModule
} from './scripts/components.module';
import {
CustomComponentsModule
} from './scripts/custom-components.module';
import {
CustomModulesModule
} from './scripts/custom-modules.module';
import {
app
} from './app';
import {
AppRoutingModule
} from './app-routing.module';
import {
WebView
} from '@ionic-native/ionic-webview/ngx';
import {
Device
} from '@ionic-native/device/ngx';
import {
SplashScreen
} from '@ionic-native/splash-screen/ngx';
import {
StatusBar
} from '@ionic-native/status-bar/ngx';
import {
Keyboard
} from '@ionic-native/keyboard/ngx';
import {
Component
} from '@angular/core';
import {
SwUpdate
} from '@angular/service-worker';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
Code: Select all
constructor(public updates:SwUpdate) {
updates.available.subscribe(event => {
console.log('current version is', event.current);
console.log('available version is', event.available);
});
updates.activated.subscribe(event => {
console.log('old version was', event.previous);
console.log('new version is', event.current);
});
updates.available.subscribe(event => {
updates.activateUpdate().then(() => this.updateApp());
});
}
updateApp(){
document.location.reload();
console.log("The app is updating right now");
}
}
@NgModule({
declarations: [
app
],
imports: [
BrowserModule,
FormsModule,
IonicModule.forRoot(),
HttpClientModule,
ApperyioModule,
PipesModule,
DirectivesModule,
ComponentsModule,
CustomComponentsModule,
CustomModulesModule,
IonicStorageModule.forRoot(),
AppRoutingModule
],
bootstrap: [
app
],
entryComponents: [
//app
],
providers: [
StatusBar,
SplashScreen,
WebView,
Device,
Keyboard,
]
})
export class AppModule {}