Skip to content

Commit fbc6bba

Browse files
committed
Merge branch 'master' into feature/schematics_ng-add
2 parents ac6251c + 59031cf commit fbc6bba

27 files changed

+419
-146
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
<a name="5.0.0-rc.12"></a>
2+
# [5.0.0-rc.12](https://github.com/angular/angularfire2/compare/5.0.0-rc.11...5.0.0-rc.12) (2018-08-24)
3+
4+
### Bug Fixes
5+
6+
* **afs:** Gracefully handle duplicate emissions on modified/deleted ([#1825](https://github.com/angular/angularfire2/issues/1825)) ([76ff6c1](https://github.com/angular/angularfire2/commit/76ff6c1))
7+
* **core:** If an AngularFire observable was empty or threw, it could block Universal rendering ([#1832](https://github.com/angular/angularfire2/issues/1832)) ([36a8ff8](https://github.com/angular/angularfire2/commit/36a8ff8))
8+
* **core:** Fix for the Firebase ES export problems in Node ([#1821](https://github.com/angular/angularfire2/issues/1821)) ([f1014ee](https://github.com/angular/angularfire2/commit/f1014ee))
9+
* **storage:** Fix for zone issues on downloadURL and metadata, which blocked Universal rendering ([#1835](https://github.com/angular/angularfire2/issues/1835)) ([441607a](https://github.com/angular/angularfire2/commit/441607a))
10+
11+
12+
### Features
13+
14+
* **firestore:** Added a `get` Observable ([#1824](https://github.com/angular/angularfire2/issues/1824)) ([9f34be8](https://github.com/angular/angularfire2/commit/9f34be8))
15+
* **messaging:** Introducing AngularFireMessaging ([#1749](https://github.com/angular/angularfire2/issues/1749)) ([26f7613](https://github.com/angular/angularfire2/commit/26f7613))
16+
17+
118
<a name="5.0.0-rc.11"></a>
219
# [5.0.0-rc.11](https://github.com/angular/angularfire2/compare/5.0.0-rc.10...5.0.0-rc.11) (2018-06-13)
320

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ Firebase offers two cloud-based, client-accessible database solutions that suppo
8686

8787
- [Getting started with Firebase Authentication](docs/auth/getting-started.md)
8888

89-
## Upload files
89+
### Upload files
9090
- [Getting started with Cloud Storage](docs/storage/storage.md)
9191

92+
### Universal
93+
- [Server-side Rendering with Universal](docs/server-side-rendering.md)
94+
9295
### Deploy to Firebase Hosting
9396

9497
- [Deploying AngularFire to Firebase Hosting](docs/deploying-angularfire-to-firebase.md)

docs/deploying-angularfire-to-firebase.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
# 7. Deploy AngularFire to Firebase
22

3-
### 0. Build your Angular project for prod
3+
### 0. Build your Angular project for production
44

5-
Before you can deploy your angular project, you need to build a version with your prod environment variables.
6-
Make sure to add your production firebase configuraiton to the src/environments/environment.prod.ts before you build.
5+
Before you can deploy your angular project, you need to build a version with your prod environment variables.
6+
Make sure to add your production firebase configuraiton to the src/environments/environment.prod.ts before you build.
77

88
```bash
99
# build the angular project, creates a dist folder in your directory
1010
ng build -prod
1111
```
1212

13-
### 1. Run Firebase init
13+
### 1. Initializing a Firebase project
1414

1515
You must initialize Firebase Hosting in order to deploy your application. In order to do this run the `firebase init` command.
16-
This command prompts you to give the public directory. Choose the /dist directory created by the `ng build -prod`.
17-
`firebase init` will also ask you if you want to overwrite your index file. Type `no` since your angular app includes a index file.
16+
17+
Note: If you haven't installed the Firebase CLI yet, run this command:
18+
19+
```bash
20+
npm install --global firebase-tools
21+
```
22+
23+
- This command prompts you to enter a public directory. Enter `dist` (generated by `ng build -prod`).
24+
- The command will also ask you if you want to overwrite your index file. Type `n` since your Angular app includes a index file.
25+
- This command also prompts you whether to configure the project as a single-page app. Enter `y` if you're using Angular Router or similar. Otherwise, enter `n`.
1826

1927
### 2. Deploy your Project
2028

docs/firestore/collections.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ interface DocumentSnapshot {
7474
There are multiple ways of streaming collection data from Firestore.
7575

7676
### `valueChanges()`
77+
7778
**What is it?** - The current state of your collection. Returns an Observable of data as a synchronized array of JSON objects. All Snapshot metadata is stripped and just the method provides only the data.
7879

7980
**Why would you use it?** - When you just need a list of data. No document metadata is attached to the resulting array which makes it simple to render to a view.
@@ -83,6 +84,7 @@ There are multiple ways of streaming collection data from Firestore.
8384
**Best practices** - Use this method to display data on a page. It's simple but effective. Use `.snapshotChanges()` once your needs become more complex.
8485

8586
#### Example of persisting a Document Id
87+
8688
```ts
8789
import { Component } from '@angular/core';
8890
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
@@ -123,6 +125,7 @@ export class AppComponent {
123125
```
124126

125127
### `snapshotChanges()`
128+
126129
**What is it?** - The current state of your collection. Returns an Observable of data as a synchronized array of `DocumentChangeAction[]`.
127130

128131
**Why would you use it?** - When you need a list of data but also want to keep around metadata. Metadata provides you the underyling `DocumentReference`, document id, and array index of the single document. Having the document's id around makes it easier to use data manipulation methods. This method gives you more horsepower with other Angular integrations such as ngrx, forms, and animations due to the `type` property. The `type` property on each `DocumentChangeAction` is useful for ngrx reducers, form states, and animation states.
@@ -132,6 +135,7 @@ export class AppComponent {
132135
**Best practices** - Use an observable operator to transform your data from `.snapshotChanges()`. Don't return the `DocumentChangeAction[]` to the template. See the example below.
133136

134137
#### Example
138+
135139
```ts
136140
import { Component } from '@angular/core';
137141
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
@@ -171,13 +175,15 @@ export class AppComponent {
171175
```
172176

173177
### `stateChanges()`
178+
174179
**What is it?** - Returns an Observable of the most recent changes as a `DocumentChangeAction[]`.
175180

176181
**Why would you use it?** - The above methods return a synchronized array sorted in query order. `stateChanges()` emits changes as they occur rather than syncing the query order. This works well for ngrx integrations as you can build your own data structure in your reducer methods.
177182

178183
**When would you not use it?** - When you just need a list of data. This is a more advanced usage of AngularFirestore.
179184

180185
#### Example
186+
181187
```ts
182188
import { Component } from '@angular/core';
183189
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
@@ -214,13 +220,15 @@ export class AppComponent {
214220
```
215221

216222
### `auditTrail()`
223+
217224
**What is it?** - Returns an Observable of `DocumentChangeAction[]` as they occur. Similar to `stateChanges()`, but instead it keeps around the trail of events as an array.
218225

219226
**Why would you use it?** - This method is like `stateChanges()` except it is not ephemeral. It collects each change in an array as they occur. This is useful for ngrx integrations where you need to replay the entire state of an application. This also works as a great debugging tool for all applications. You can simple write `afs.collection('items').auditTrail().subscribe(console.log)` and check the events in the console as they occur.
220227

221228
**When would you not use it?** - When you just need a list of data. This is a more advanced usage of AngularFirestore.
222229

223230
#### Example
231+
224232
```ts
225233
import { Component } from '@angular/core';
226234
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
@@ -260,15 +268,17 @@ export class AppComponent {
260268

261269
There are three `DocumentChangeType`s in Firestore: `added`, `removed`, and `modified`. Each streaming method listens to all three by default. However, you may only be intrested in one of these events. You can specify which events you'd like to use through the first parameter of each method:
262270

263-
#### Basic sample
271+
#### Basic example
272+
264273
```ts
265274
constructor(private afs: AngularFirestore): {
266275
this.itemsCollection = afs.collection<Item>('items');
267276
this.items = this.itemsCollection.snapshotChanges(['added', 'removed']);
268277
}
269278
```
270279

271-
#### Component Sample
280+
#### Component example
281+
272282
```ts
273283
import { Component } from '@angular/core';
274284
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
@@ -304,7 +314,8 @@ For example, a user updates the third item in a list. In a state based method li
304314

305315
To add a new document to a collection with a generated id use the `add()` method. This method uses the type provided by the generic class to validate it's type structure.
306316

307-
#### Basic Sample
317+
#### Basic example
318+
308319
```ts
309320
constructor(private afs: AngularFirestore): {
310321
const shirtsCollection = afs.collection<Item>('tshirts');

docs/firestore/documents.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { Component } from '@angular/core';
1212
import { AngularFirestore, AngularFirestoreDocument } from 'angularfire2/firestore';
1313
import { Observable } from 'rxjs';
1414

15+
export interface Item { name: string; }
16+
1517
@Component({
1618
selector: 'app-root',
1719
template: `
@@ -68,13 +70,15 @@ interface DocumentSnapshot {
6870
There are multiple ways of streaming collection data from Firestore.
6971

7072
### `valueChanges()`
73+
7174
**What is it?** - Returns an Observable of document data. All Snapshot metadata is stripped. This method provides only the data.
7275

7376
**Why would you use it?** - When you just need the object data. No document metadata is attached which makes it simple to render to a view.
7477

7578
**When would you not use it?** - When you need the `id` of the document to use data manipulation methods. This method assumes you either are saving the `id` to the document data or using a "readonly" approach.
7679

7780
### `snapshotChanges()`
81+
7882
**What is it?** - Returns an Observable of data as a `DocumentChangeAction`.
7983

8084
**Why would you use it?** - When you need the document data but also want to keep around metadata. This metadata provides you the underyling `DocumentReference` and document id. Having the document's id around makes it easier to use data manipulation methods. This method gives you more horsepower with other Angular integrations such as ngrx, forms, and animations due to the `type` property. The `type` property on each `DocumentChangeAction` is useful for ngrx reducers, form states, and animation states.

docs/firestore/querying-collections.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Queries are created by building on the [`firebase.firestore.CollectionReference`
1111
afs.collection('items', ref => ref.where('size', '==', 'large'))
1212
```
1313

14-
**Query Options:**
14+
### Query options
1515

1616
| method | purpose |
1717
| ---------|--------------------|
@@ -77,7 +77,7 @@ size$.next('large');
7777
size$.next('small');
7878
```
7979

80-
**Example app:**
80+
### Example app
8181

8282
[See this example in action on StackBlitz](https://stackblitz.com/edit/angularfire-db-api-fbad9p).
8383

@@ -156,9 +156,9 @@ export class AppComponent {
156156
}
157157
```
158158

159-
**To run the above example as is, you need to have sample data in you firebase database with the following structure:**
160-
161-
```json
159+
**To run the above example as is, you need to have sample data in your Firebase database with the following structure:**
160+
161+
```json
162162
{
163163
"items": {
164164
"a" : {
@@ -178,6 +178,6 @@ export class AppComponent {
178178
}
179179
}
180180
}
181-
```
181+
```
182182

183183
### [Next Step: Getting started with Firebase Authentication](../auth/getting-started.md)

docs/install-and-setup.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> Using Ionic and the Ionic CLI? Check out these [specific instructions](ionic/cli.md) for Ionic and their CLI.
44
5-
> Following instructions use `ng add` command that automates several steps for you. If you want to set up things manually refer to [these steps](install-and-setup-manual.md) instead.
5+
> The following instructions use the `ng add` command that automates several steps for you. If you want to set up things manually, refer to [these steps](install-and-setup-manual.md) instead.
66
77
### 0. Prerequisites
88

@@ -52,7 +52,7 @@ By providing the `--all` flag you can also add modules for the individual @NgMod
5252
- `AngularFireStorageModule`
5353
- `AngularFireMessagingModule` (Future release)
5454

55-
### 4. Edit Firebase config in environments variable
55+
### 4. Edit Firebase configuration
5656

5757
Open `/src/environments/environment.ts` and edit your Firebase configuration. You can find your project configuration in [the Firebase Console](https://console.firebase.google.com). From the project overview page, click **Add Firebase to your web app**.
5858

@@ -66,7 +66,7 @@ export const environment = {
6666
storageBucket: '<your-storage-bucket>',
6767
messagingSenderId: '<your-messaging-sender-id>',
6868
},
69-
production: false,
69+
production: false
7070
};
7171
```
7272

@@ -81,7 +81,7 @@ import { AngularFirestore } from 'angularfire2/firestore';
8181
@Component({
8282
selector: 'app-root',
8383
templateUrl: 'app.component.html',
84-
styleUrls: ['app.component.css'],
84+
styleUrls: ['app.component.css']
8585
})
8686
export class AppComponent {
8787
constructor(db: AngularFirestore) {}
@@ -100,7 +100,7 @@ import { Observable } from 'rxjs';
100100
@Component({
101101
selector: 'app-root',
102102
templateUrl: 'app.component.html',
103-
styleUrls: ['app.component.css'],
103+
styleUrls: ['app.component.css']
104104
})
105105
export class AppComponent {
106106
items: Observable<any[]>;

docs/install-angular-cli-windows10.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Installing angular-cli on Windows 10
1+
# Installing Angular CLI on Windows 10
22

3-
> There had been installation issues of angular-cli on Windows 10 system. Most of the time these errors are related to Python dependecies and node-gyp.
3+
> There had been installation issues of `@angular/cli` on Windows 10 system. Most of the time these errors are related to Python dependecies and node-gyp.
44
55
Something as below :
66

@@ -33,39 +33,42 @@ ngular-cli\node_modules\compression-webpack-plugin\node_modules\node-zopfli
3333
.......................
3434
```
3535
36-
To resolve this issue, make sure you're upgraded to latest version of **NPM** and try installing angular-cli. This seems to have worked on certain scenarios.
36+
To resolve this issue, make sure you've upgraded to the latest version of **NPM** and try installing `@angular/cli` again. This seems to have worked on certain scenarios.
3737
38-
If the above doesn't works then the below steps should help. Please ensure all the commands are executed as an **Administrator**.
38+
If the above doesn't work then the below steps should help. Please ensure all the commands are executed as an **Administrator**.
3939
40-
### Steps:
40+
## Steps:
4141
42-
### 1) Install node-gyp from [here](https://github.com/nodejs/node-gyp)
42+
### 1) Install `node-gyp` from [here](https://github.com/nodejs/node-gyp) using NPM
4343
44-
```ts
44+
```bash
4545
npm install -g node-gyp
4646
```
4747
48-
### 2) Install Windows build tool from [here](https://github.com/felixrieseberg/windows-build-tools)
48+
### 2) Install Windows build tools from [here](https://github.com/felixrieseberg/windows-build-tools) using NPM
4949
50-
```ts
50+
```bash
5151
npm install --global windows-build-tools
5252
```
5353
54-
*This will also install python
54+
*This will also install Python
5555
56-
### 3) Install Angular-CLI
56+
### 3) Install Angular CLI
5757
58-
npm install -g angular-cli
58+
```bash
59+
npm install -g @angular/cli
60+
```
5961
60-
This should install angular-cli without errors.
62+
This should install `@angular/cli` without errors.
6163
6264
#### Post this installation, follow the installation [guide](https://github.com/angular/angularfire2/blob/master/docs/install-and-setup.md) to install AngularFire and everything should work as expected.
6365
6466
6567
### Note:
66-
When you start your app using "ng serve" in the console, you might still see the below errors. Despite these errors, the application should work as expected and should be able to talk to Firebase.
6768
68-
```ts
69+
When you start your app using `ng serve` in the console, you might still see the below errors. Despite these errors, the application should work as expected and should be able to talk to Firebase.
70+
71+
```bash
6972
ERROR in [default] C:\angularFire2Test\node_modules\angularfire2\interfaces.d.ts:12:34
7073
Cannot find namespace 'firebase'.
7174

0 commit comments

Comments
 (0)