@angular/fire 7.5.0 → 7.6.0-canary.59b95af
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -71
- package/bundles/angular-fire.umd.js +1 -1
- package/bundles/angular-fire.umd.js.map +1 -1
- package/compat/firestore/interfaces.d.ts +4 -4
- package/docs/analytics.md +67 -0
- package/docs/app-check.md +53 -0
- package/docs/auth.md +165 -0
- package/docs/{analytics → compat/analytics}/getting-started.md +2 -0
- package/docs/{auth → compat/auth}/getting-started.md +2 -0
- package/docs/{auth → compat/auth}/router-guards.md +2 -0
- package/docs/{emulators → compat/emulators}/emulators.md +2 -0
- package/docs/{firestore → compat/firestore}/collections.md +2 -0
- package/docs/{firestore → compat/firestore}/documents.md +2 -0
- package/docs/{firestore → compat/firestore}/offline-data.md +2 -0
- package/docs/{firestore → compat/firestore}/querying-collections.md +2 -0
- package/docs/{functions → compat/functions}/functions.md +2 -0
- package/docs/{messaging → compat/messaging}/messaging.md +2 -0
- package/docs/{performance → compat/performance}/getting-started.md +2 -0
- package/docs/{remote-config → compat/remote-config}/getting-started.md +2 -0
- package/docs/{rtdb → compat/rtdb}/lists.md +2 -0
- package/docs/{rtdb → compat/rtdb}/objects.md +2 -0
- package/docs/{rtdb → compat/rtdb}/querying-lists.md +2 -0
- package/docs/{storage → compat/storage}/storage.md +2 -0
- package/docs/compat.md +70 -0
- package/docs/database.md +175 -0
- package/docs/firestore.md +148 -0
- package/docs/functions.md +52 -0
- package/docs/images/analytics-illo_1x.png +0 -0
- package/docs/images/auth-illo_1x.png +0 -0
- package/docs/images/cloud-messaging-illo_1x.png +0 -0
- package/docs/images/database-illo_1x.png +0 -0
- package/docs/images/firestore-illo_1x.png +0 -0
- package/docs/images/functions-illo_1x.png +0 -0
- package/docs/images/hosting-illo_1x.png +0 -0
- package/docs/images/performance-illo_1x.png +0 -0
- package/docs/images/reCAPTCHA-logo@1x.png +0 -0
- package/docs/images/remote-config-illo_1x.png +0 -0
- package/docs/images/storage-illo_1x.png +0 -0
- package/docs/install-and-setup.md +39 -86
- package/docs/messaging.md +25 -0
- package/docs/performance.md +57 -0
- package/docs/remote-config.md +53 -0
- package/docs/storage.md +90 -0
- package/esm2015/compat/firestore/interfaces.js +1 -1
- package/esm2015/core.js +1 -1
- package/fesm2015/angular-fire.js +1 -1
- package/fesm2015/angular-fire.js.map +1 -1
- package/package.json +9 -10
- package/schematics/deploy/actions.js +23 -14
- package/schematics/deploy/builder.js +2 -2
- package/schematics/firebaseTools.js +4 -2
- package/schematics/setup/index.js +58 -29
- package/schematics/setup/prompts.js +18 -46
- package/schematics/utils.js +32 -28
- package/docs/ionic/authentication.md +0 -104
- package/docs/ionic/cli.md +0 -218
- package/docs/ionic/v2.md +0 -531
- package/docs/ionic/v3.md +0 -705
- package/schematics/setup/ssr.js +0 -100
- package/schematics/setup/static.js +0 -78
package/docs/ionic/cli.md
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
# Installation and Setup with Ionic CLI
|
|
2
|
-
|
|
3
|
-
### 0. Prerequisites
|
|
4
|
-
|
|
5
|
-
Before you start installing AngularFire, make sure you have latest version of Ionic cli installed.
|
|
6
|
-
To verify run the command `ionic -v` and check your version. The CLI should be at least version 3.0.0 or greater.
|
|
7
|
-
|
|
8
|
-
If not, you may need to do the following:
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
# if you have the wrong cli version only
|
|
12
|
-
npm uninstall -g ionic
|
|
13
|
-
npm cache clean
|
|
14
|
-
|
|
15
|
-
# reinstall clean version
|
|
16
|
-
npm install -g @ionic/cli
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### 1. Create a new project
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
ionic start <project-name>
|
|
23
|
-
cd <project-name>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
The Ionic CLI's `start` command will prompt you to pick a starting template, and scaffold out the project for you.
|
|
27
|
-
|
|
28
|
-
### 2. Test your Setup
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
ionic serve
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Your default browser should start up and display a working Ionic app.
|
|
35
|
-
|
|
36
|
-
### 3. Install AngularFire 2 and Firebase
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install @angular/fire firebase --save
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Now that you have a new project setup, install AngularFire and Firebase from npm.
|
|
43
|
-
|
|
44
|
-
### 4. Add Firebase config to environments variable
|
|
45
|
-
|
|
46
|
-
Let's create a new file, `src/environment.ts` and start adding our Firebase config:
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
export const firebaseConfig = {
|
|
50
|
-
apiKey: '<your-key>',
|
|
51
|
-
authDomain: '<your-project-authdomain>',
|
|
52
|
-
databaseURL: '<your-database-URL>',
|
|
53
|
-
projectId: '<your-project-id>',
|
|
54
|
-
storageBucket: '<your-storage-bucket>',
|
|
55
|
-
messagingSenderId: '<your-messaging-sender-id>'
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
### 5. Setup @NgModule for the AngularFireModule
|
|
62
|
-
|
|
63
|
-
Open `/src/app/app.module.ts`, inject the Firebase providers, and specify your Firebase configuration.
|
|
64
|
-
This can be found in your project at [the Firebase Console](https://console.firebase.google.com):
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
68
|
-
import { NgModule } from '@angular/core';
|
|
69
|
-
import { IonicApp, IonicModule } from 'ionic-angular';
|
|
70
|
-
import { MyApp } from './app.component';
|
|
71
|
-
|
|
72
|
-
import { AngularFireModule } from '@angular/fire/compat';
|
|
73
|
-
import { firebaseConfig } from '../environment';
|
|
74
|
-
|
|
75
|
-
@NgModule({
|
|
76
|
-
declarations: [ MyApp ],
|
|
77
|
-
imports: [
|
|
78
|
-
BrowserModule,
|
|
79
|
-
IonicModule.forRoot(MyApp),
|
|
80
|
-
AngularFireModule.initializeApp(firebaseConfig)
|
|
81
|
-
],
|
|
82
|
-
bootstrap: [IonicApp],
|
|
83
|
-
})
|
|
84
|
-
export class AppModule {}
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
There will be more or less imports depending on your app. This is just an example setup.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
#### Custom FirebaseApp Names
|
|
92
|
-
You can optionally provide a custom FirebaseApp name with `initializeApp`.
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
@NgModule({
|
|
96
|
-
declarations: [ MyApp ],
|
|
97
|
-
imports: [
|
|
98
|
-
BrowserModule,
|
|
99
|
-
IonicModule.forRoot(MyApp),
|
|
100
|
-
AngularFireModule.initializeApp(firebaseConfig, 'my-app-name')
|
|
101
|
-
],
|
|
102
|
-
bootstrap: [IonicApp],
|
|
103
|
-
})
|
|
104
|
-
export class AppModule {}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### 6. Setup individual @NgModules
|
|
108
|
-
|
|
109
|
-
After adding the AngularFireModule you also need to add modules for the individual @NgModules that your application needs.
|
|
110
|
-
- AngularFireAuthModule
|
|
111
|
-
- AngularFireDatabaseModule
|
|
112
|
-
- AngularFireFunctionsModule
|
|
113
|
-
- AngularFirestoreModule
|
|
114
|
-
- AngularFireStorageModule
|
|
115
|
-
- AngularFireMessagingModule
|
|
116
|
-
|
|
117
|
-
#### Adding the Firebase Database and Auth Modules
|
|
118
|
-
|
|
119
|
-
For example if you application was using both Firebase authentication and the Firebase database you would add:
|
|
120
|
-
|
|
121
|
-
```ts
|
|
122
|
-
import { BrowserModule } from '@angular/platform-browser';
|
|
123
|
-
import { NgModule } from '@angular/core';
|
|
124
|
-
import { IonicApp, IonicModule } from 'ionic-angular';
|
|
125
|
-
import { MyApp } from './app.component';
|
|
126
|
-
|
|
127
|
-
import { AngularFireModule } from '@angular/fire/compat';
|
|
128
|
-
import { firebaseConfig } from '../environment';
|
|
129
|
-
import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
|
|
130
|
-
import { AngularFireAuthModule } from '@angular/fire/compat/auth';
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
@NgModule({
|
|
134
|
-
declarations: [ MyApp ],
|
|
135
|
-
imports: [
|
|
136
|
-
BrowserModule,
|
|
137
|
-
IonicModule.forRoot(MyApp),
|
|
138
|
-
AngularFireModule.initializeApp(firebaseConfig), // imports firebase/app needed for everything
|
|
139
|
-
AngularFireDatabaseModule, // imports firebase/database, only needed for database features
|
|
140
|
-
AngularFireAuthModule, // imports firebase/auth, only needed for auth features
|
|
141
|
-
],
|
|
142
|
-
bootstrap: [IonicApp],
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### 7. Inject AngularFireDatabase
|
|
148
|
-
|
|
149
|
-
Open `/src/pages/home/home.ts`, and start to import `AngularFireDatabase` and `FirebaseListObservable`:
|
|
150
|
-
|
|
151
|
-
```ts
|
|
152
|
-
import { Component } from '@angular/core';
|
|
153
|
-
import { NavController } from 'ionic-angular';
|
|
154
|
-
import { AngularFireDatabase } from '@angular/fire/compat/database';
|
|
155
|
-
import { Observable } from 'rxjs/Observable';
|
|
156
|
-
|
|
157
|
-
@Component({
|
|
158
|
-
selector: 'page-home',
|
|
159
|
-
templateUrl: 'home.html'
|
|
160
|
-
})
|
|
161
|
-
export class HomePage {
|
|
162
|
-
items: Observable<any[]>;
|
|
163
|
-
constructor(
|
|
164
|
-
public db: AngularFireDatabase,
|
|
165
|
-
public navCtrl: NavController,
|
|
166
|
-
) {}
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### 8. Bind to a list
|
|
172
|
-
|
|
173
|
-
In `/src/pages/home/home.ts`:
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
import { Component } from '@angular/core';
|
|
177
|
-
import { NavController } from 'ionic-angular';
|
|
178
|
-
import { AngularFireDatabase } from '@angular/fire/compat/database';
|
|
179
|
-
import { Observable } from 'rxjs/Observable';
|
|
180
|
-
|
|
181
|
-
@Component({
|
|
182
|
-
selector: 'page-home',
|
|
183
|
-
templateUrl: 'home.html'
|
|
184
|
-
})
|
|
185
|
-
export class HomePage {
|
|
186
|
-
items: Observable<any[]>;
|
|
187
|
-
constructor(
|
|
188
|
-
public db: AngularFireDatabase,
|
|
189
|
-
public navCtrl: NavController,
|
|
190
|
-
) {
|
|
191
|
-
this.items = db.list('list').valueChanges();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Open `/src/pages/home/home.html`:
|
|
198
|
-
|
|
199
|
-
```html
|
|
200
|
-
<ion-header>
|
|
201
|
-
---
|
|
202
|
-
</ion-header>
|
|
203
|
-
|
|
204
|
-
<ion-content padding>
|
|
205
|
-
<ion-item *ngFor="let item of items | async">
|
|
206
|
-
{{item | json}}
|
|
207
|
-
</ion-item>
|
|
208
|
-
</ion-content>
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### 9. Run your app
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
ionic serve
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
That's it! If there's any issues, be sure to file an issue on the AngularFire repo or the Ionic repo, depending on who's to blame :smile:
|
|
218
|
-
|