|
1 | 1 | # AngularFire |
2 | 2 | The official [Angular](https://angular.io/) library for [Firebase](https://firebase.google.com/). |
3 | 3 |
|
4 | | -<strong><pre>ng add @angular/fire@next</pre></strong> |
| 4 | +<strong><pre>ng add @angular/fire</pre></strong> |
5 | 5 |
|
6 | 6 | AngularFire smooths over the rough edges an Angular developer might encounter when implementing the framework-agnostic [Firebase JS SDK](https://github.com/firebase/firebase-js-sdk) & aims to provide a more natural developer experience by conforming to Angular conventions. |
7 | 7 |
|
@@ -14,21 +14,27 @@ AngularFire smooths over the rough edges an Angular developer might encounter wh |
14 | 14 | - **Google Analytics** - Zero-effort Angular Router awareness in Google Analytics |
15 | 15 | - **Router Guards** - Guard your Angular routes with built-in Firebase Authentication checks |
16 | 16 |
|
17 | | ---- |
18 | | - |
19 | | -> **WARNING**: This branch is the work in progress for version 7 of AngularFire. [You can find version 6 here](https://github.com/angular/angularfire/tree/v6), if you're looking for documentation or to contribute to stable. |
20 | | -
|
21 | | ---- |
22 | | - |
23 | 17 | ## Example use |
24 | 18 |
|
25 | 19 | ```ts |
26 | | -import { Component } from '@angular/core'; |
| 20 | +import { provideFirebaseApp, getApp, initializeApp } from '@angular/fire/app'; |
| 21 | +import { getFirestore, provideFirestore } from '@angular/fire/firestore'; |
| 22 | + |
| 23 | +@NgModule({ |
| 24 | + imports: [ |
| 25 | + provideFirebaseApp(() => initializeApp({ ... })), |
| 26 | + provideFirestore(() => getFirestore()), |
| 27 | + ], |
| 28 | + ... |
| 29 | +}) |
| 30 | +export class AppModule { } |
| 31 | +``` |
| 32 | + |
| 33 | +```ts |
27 | 34 | import { Firestore, collectionData, collection } from '@angular/fire/firestore'; |
28 | 35 | import { Observable } from 'rxjs'; |
29 | 36 |
|
30 | 37 | interface Item { |
31 | | - id: string, |
32 | 38 | name: string, |
33 | 39 | ... |
34 | 40 | }; |
@@ -43,11 +49,11 @@ interface Item { |
43 | 49 | </ul> |
44 | 50 | ` |
45 | 51 | }) |
46 | | -export class MyApp { |
| 52 | +export class AppComponent { |
47 | 53 | item$: Observable<Item[]>; |
48 | 54 | constructor(firestore: Firestore) { |
49 | 55 | const collection = collection(firestore, 'items'); |
50 | | - this.item$ = collectionData(collection, 'id'); |
| 56 | + this.item$ = collectionData(collection); |
51 | 57 | } |
52 | 58 | } |
53 | 59 | ``` |
@@ -60,7 +66,7 @@ AngularFire doesn't follow Angular's versioning as Firebase also has breaking ch |
60 | 66 |
|
61 | 67 | | Angular | Firebase | AngularFire | |
62 | 68 | | --------|----------|--------------| |
63 | | -| 12 | [9 <sup>beta</sup>](https://firebase.google.com/docs/web/learn-more#modular-version) | ^7.0 <sup>beta</sup> | |
| 69 | +| 12 | 9 | ^7.0 | |
64 | 70 | | 12 | 7,8 | ^6.1.5 | |
65 | 71 | | 11 | 7,8 | ^6.1 | |
66 | 72 | | 10 | 8 | ^6.0.4 | |
@@ -100,7 +106,11 @@ Neither AngularFire or Firebase ship with polyfills. To have compatability acros |
100 | 106 |
|
101 | 107 | ## Developer Guide |
102 | 108 |
|
103 | | -### **NEW:** Monitor usage of your application in production |
| 109 | +AngularFire has a new tree-shakable API, however this is still under active development and documentation is in the works, so we suggest most developers stick with the Compatiability API for the time being. [See the v7 upgrade guide for more information.](docs/version-7-upgrade.md). |
| 110 | + |
| 111 | +This developer guide assumes you're using the Compatiability API (`@angular/fire/compat/*`). |
| 112 | + |
| 113 | +### Monitor usage of your application in production |
104 | 114 |
|
105 | 115 | > `AngularFireAnalytics` provides a convenient method of interacting with Google Analytics in your Angular application. The provided `ScreenTrackingService` and `UserTrackingService` automatically log events when you're using the Angular Router or Firebase Authentication respectively. [Learn more about Google Analytics](https://firebase.google.com/docs/analytics). |
106 | 116 |
|
@@ -150,7 +160,7 @@ Firebase offers two cloud-based, client-accessible database solutions that suppo |
150 | 160 |
|
151 | 161 | - [Getting started with Remote Config](docs/remote-config/getting-started.md) |
152 | 162 |
|
153 | | -### **NEW:** Monitor your application performance in production |
| 163 | +### Monitor your application performance in production |
154 | 164 |
|
155 | 165 | > Firebase Performance Monitoring is a service that helps you to gain insight into the performance characteristics of your iOS, Android, and web apps. [Learn more about Performance Monitoring](https://firebase.google.com/docs/perf-mon). |
156 | 166 |
|
|