UNPKG

1.39 kBMarkdownView Raw
1[![npm](https://img.shields.io/npm/v/@ionic/cloud-angular.svg?maxAge=2592000)](https://www.npmjs.com/package/@ionic/cloud-angular)
2
3# Ionic Cloud Client for Angular 2
4
5Angular 2 integration for the Ionic Cloud in your app.
6
7## Installation
8
9```bash
10$ npm install --save @ionic/cloud-angular
11```
12
13## Usage
14
15In your `app.ts` file, tell Angular about the Ionic Cloud providers by calling
16the imported `provideCloud` function with a config and passing it to
17[`ionicBootstrap`](http://ionicframework.com/docs/v2/api/config/Config/)
18function. Then, use the injectable cloud classes (`Auth`, `User`, `Push`,
19`Deploy`, etc.) in your app's classes just as you would any other service
20class.
21
22```javascript
23import ...
24import {Auth, User, CloudSettings, provideCloud} from '@ionic/cloud-angular';
25
26const cloudSettings: CloudSettings = {
27 'core': {
28 'app_id': 'YOUR-APP-ID'
29 }
30};
31
32@Component({
33 template: '<ion-nav [root]="rootPage"></ion-nav>'
34})
35export class MyApp {
36 rootPage: any = TabsPage;
37
38 constructor(platform: Platform, user: User) {
39 platform.ready().then(() => {
40 Auth.signup({'email': 'hi@ionic.io', 'password': 'puppies123'}).then(() => {
41 // `user` is now the authenticated user
42 }, (err) => {
43 // something went wrong!
44 });
45 });
46 }
47}
48
49// Register the Ionic Cloud in the bootstrap
50ionicBootstrap(MyApp, [provideCloud(cloudSettings)]);
51```