Skip to content

aritas1/ionic-cloud-angular

 
 

Repository files navigation

npm

Ionic Cloud Client for Angular 2

Angular 2 integration for the Ionic Cloud in your app.

Installation

$ npm install --save @ionic/cloud-angular

Usage

In your app.ts file, tell Angular about the Ionic Cloud providers by calling the imported provideCloud function with a config and passing it to ionicBootstrap function. Then, use the injectable cloud classes (Auth, User, Push, Deploy, etc.) in your app's classes just as you would any other service class.

import ...
import {Auth, User, CloudSettings, provideCloud} from '@ionic/cloud-angular';

const cloudSettings: CloudSettings = {
  'core': {
    'app_id': 'YOUR-APP-ID'
  }
};

@Component({
  template: '<ion-nav [root]="rootPage"></ion-nav>'
})
export class MyApp {
  rootPage: any = TabsPage;

  constructor(platform: Platform, public auth: Auth, public user: User) {
    platform.ready().then(() => {
      let details = {'email': '[email protected]', 'password': 'puppies123'};
      this.auth.signup(details).then(() => {
        return this.auth.login(details);
      }).then(() => {
        // `this.user` is now the authenticated user
      }, (err) => {
        // something went wrong!
      });
    });
  }
}

// Register the Ionic Cloud in the bootstrap
ionicBootstrap(MyApp, [provideCloud(cloudSettings)]);

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 80.3%
  • JavaScript 19.7%