Angular 2 integration for the Ionic Cloud in your app.
$ npm install --save @ionic/cloud-angularIn 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('basic', details);
}).then(() => {
// `this.user` is now the authenticated user
}, (err) => {
// something went wrong!
});
});
}
}
// Register the Ionic Cloud in the bootstrap
ionicBootstrap(MyApp, [provideCloud(cloudSettings)]);