Skip to content

Commit 8bb3125

Browse files
committed
docs(afs): README and links
1 parent 7aaa9f8 commit 8bb3125

File tree

4 files changed

+36
-52
lines changed

4 files changed

+36
-52
lines changed

README.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,24 @@ If you want to get started quickly on building with AngularFire2, check out our
5555
5 step developer guide that will teach you everything you need to know to be
5656
productive with AngularFire2.
5757

58-
1. [Installation & Setup](docs/1-install-and-setup.md)
59-
2. [Retrieving data as objects - FirebaseObjectObservable](docs/2-retrieving-data-as-objects.md)
60-
3. [Retrieving data as lists - FirebaseListObservable](docs/3-retrieving-data-as-lists.md)
61-
4. [Querying lists](docs/4-querying-lists.md)
62-
5. [User Authentication - FirebaseAuthentication](docs/5-user-authentication.md)
63-
6. [Using AngularFire2 with Ionic 2](docs/Auth-with-Ionic2.md)
64-
7. [Using AngularFire2 with Ionic 3 and Angular 4](docs/Auth-with-Ionic3-Angular4.md)
65-
8. [Deploying AngularFire2 to FirebaseHosting](docs/7-deploying-angularfire-to-firebase.md)
58+
## Getting started
59+
[Installation & Setup](docs/1-install-and-setup.md)
60+
61+
## AngularFirestore
62+
[Using collections](docs/firestore/collections.md)
63+
[Using documents](docs/firestore/documents.md)
64+
65+
## AngularFireAuth
66+
[User Authentication](docs/5-user-authentication.md)
67+
68+
## AngularFireDatabase
69+
[Retrieving data as objects](docs/2-retrieving-data-as-objects.md)
70+
[Retrieving data as lists](docs/3-retrieving-data-as-lists.md)
71+
[Querying lists](docs/4-querying-lists.md)
72+
73+
## Ionic
74+
[Using AngularFire2 with Ionic 2](docs/Auth-with-Ionic2.md)
75+
[Using AngularFire2 with Ionic 3 and Angular 4](docs/Auth-with-Ionic3-Angular4.md)
76+
77+
## Deploying to Firebase Hosting
78+
[Deploying AngularFire to Firebase Hosting](docs/7-deploying-angularfire-to-firebase.md)

docs/1-install-and-setup.md

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class AppModule {}
118118
### 6. Setup individual @NgModules
119119

120120
After adding the AngularFireModule you also need to add modules for the individual @NgModules that your application needs.
121+
- AngularFirestoreModule
121122
- AngularFireAuthModule
122123
- AngularFireDatabaseModule
123124
- AngularFireStorageModule (Future release)
@@ -132,15 +133,15 @@ import { BrowserModule } from '@angular/platform-browser';
132133
import { NgModule } from '@angular/core';
133134
import { AppComponent } from './app.component';
134135
import { AngularFireModule } from 'angularfire2';
135-
import { AngularFireDatabaseModule } from 'angularfire2/database';
136+
import { AngularFirestoreModule } from 'angularfire2/firestore';
136137
import { AngularFireAuthModule } from 'angularfire2/auth';
137138
import { environment } from '../environments/environment';
138139

139140
@NgModule({
140141
imports: [
141142
BrowserModule,
142143
AngularFireModule.initializeApp(environment.firebase, 'my-app-name'), // imports firebase/app needed for everything
143-
AngularFireDatabaseModule, // imports firebase/database, only needed for database features
144+
AngularFirestoreModule, // imports firebase/firestore, only needed for database features
144145
AngularFireAuthModule, // imports firebase/auth, only needed for auth features
145146
],
146147
declarations: [ AppComponent ],
@@ -150,21 +151,21 @@ export class AppModule {}
150151

151152
```
152153

153-
### 7. Inject AngularFireDatabase
154+
### 7. Inject AngularFirestore
154155

155156
Open `/src/app/app.component.ts`, and make sure to modify/delete any tests to get the sample working (tests are still important, you know):
156157

157158
```ts
158159
import { Component } from '@angular/core';
159-
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
160+
import { AngularFirestore } from 'angularfire2/firestore';
160161

161162
@Component({
162163
selector: 'app-root',
163164
templateUrl: 'app.component.html',
164165
styleUrls: ['app.component.css']
165166
})
166167
export class AppComponent {
167-
constructor(db: AngularFireDatabase) {
168+
constructor(db: AngularFirestore) {
168169

169170
}
170171
}
@@ -177,17 +178,18 @@ In `/src/app/app.component.ts`:
177178

178179
```ts
179180
import { Component } from '@angular/core';
180-
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
181+
import { AngularFirestore } from 'angularfire2/firestore';
182+
import { Observable } from 'rxjs/Observable';
181183

182184
@Component({
183185
selector: 'app-root',
184186
templateUrl: 'app.component.html',
185187
styleUrls: ['app.component.css']
186188
})
187189
export class AppComponent {
188-
items: FirebaseListObservable<any[]>;
189-
constructor(db: AngularFireDatabase) {
190-
this.items = db.list('/items');
190+
items: Observable<any[]>;
191+
constructor(db: AngularFirestore) {
192+
this.items = db.collection('items').valueChanges();
191193
}
192194
}
193195
```
@@ -197,7 +199,7 @@ Open `/src/app/app.component.html`:
197199
```html
198200
<ul>
199201
<li class="text" *ngFor="let item of items | async">
200-
{{item.$value}}
202+
{{item.name}}
201203
</li>
202204
</ul>
203205
```
@@ -212,35 +214,4 @@ Run the serve command and go to `localhost:4200` in your browser.
212214

213215
And that's it! If it's totally *borked*, file an issue and let us know.
214216

215-
### [Next Step: Retrieving data as objects](2-retrieving-data-as-objects.md)
216-
217-
### Troubleshooting
218-
219-
#### 1. Cannot find namespace 'firebase'.
220-
221-
If you run into this error while trying to invoke `ng serve`, open `src/tsconfig.json` and add the "types" array as follows:
222-
223-
```json
224-
{
225-
"compilerOptions": {
226-
...
227-
"typeRoots": [
228-
"../node_modules/@types"
229-
],
230-
231-
// ADD THIS
232-
"types": [
233-
"firebase"
234-
]
235-
}
236-
}
237-
```
238-
239-
#### 2. Cannot find name 'require' (This is just a temporary workaround for the Angular CLI).
240-
241-
If you run into this error while trying to invoke `ng serve`, open `src/typings.d.ts` and add the following two entries as follows:
242-
243-
```bash
244-
declare var require: any;
245-
declare var module: any;
246-
```
217+
### [Next Step: Understanding collections in Firestore](firestore/collections.md)

docs/firestore/collections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,4 @@ To add a new document to a collection with a generated id use the `add()` method
217217

218218
To retrieve, update, or delete an individual document you can use the `doc()` method. This method returns an `AngularFirestoreDocument`, which provides methods for streaming, updating, and deleting.
219219

220-
See the Documents page for complete documentation.
220+
See the [Documents page for complete documentation]((docs/firestore/documents.md).

docs/firestore/documents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ To retrieve a nested collection use the `collection(path: string)` method.
107107
}
108108
```
109109

110-
For more information about using collections read the collection documentation.
110+
For more information about using collections read the [collection documentation](docs/firestore/collection.md).

0 commit comments

Comments
 (0)