Angular 2, Cordova + Ionic Cloud Package & Deploy

Hi guys, congratulations on going final with Ionic.

Our team is working on an Angular 2 webapp with an additional Cordova wrapper. All works perfect but we have a requirement to update the webapp without updating the native app. I’ve checked out some custom Cordova plugins, which all seem more or less difficult to configure.

I’ve looked at Ionic Cloud Deploy docs and it seems perfect, but I have a couple of questions:

  • basically we want to just use Ionic Cloud Package & Deploy with our own Angular 2 app. Is it possible to remove all Ionic 2 framework specific styles and components?
  • is it possible to use the @angular/router 3.x.x or do we have change our codebase to use Ionic navigation?

Thanks for your help!

Got it to run on my own, for anybody looking for the same:

  1. npm install @ionic/cloud-angular

  2. cordova plugin add ionic-plugin-deploy

  3. In app.module.ts

     import { CoreModule } from './core/core.module';
     CloudModule.forRoot({
     		core: {
     			app_id: 'xxxxxxx'
     		},
     	}),
    
  4. In app.component.ts

     ngOnInit(): void {
     console.log('checking for snapshot');
    
     this.deploy.check()
     	.then(snapshotAvailable => {
     		if (snapshotAvailable) {
     			this.deploy.download()
     				.then(() => this.deploy.extract()
     					.then(() => this.deploy.load()));
     		}
     	});
     }
    
  5. Create ionic.config.json inside root folder

  6. ionic upload and it works :smiley:

Thanks for sharing this. Is it safe to assume you dropped this in the platform.ready method?

No, I’ve dropped it into the ngOnInit method of app.component.ts.

I completely overlooked that, Thank you for clarifying. I am experiencing a white screen on the load. Did you also experience such?