Skip to content

Commit 4bf9a5d

Browse files
jamesdanielsdavideast
authored andcommitted
Comments about import from 'firebase' + used
1 parent 863310e commit 4bf9a5d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/version-4-upgrade.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ In 4.0 we've reduced the complexity of the auth module by providing only a [`fir
3434

3535
```typescript
3636
import { AngularFireAuth } from 'angularfire2/auth';
37-
37+
// Do not import from 'firebase' as you'd lose the tree shaking benefits
38+
import * as firebase from 'firebase/app';
3839
...
3940

4041
user: Observable<firebase.User>;
@@ -49,7 +50,7 @@ While convenient, the pre-configured login feature added unneeded complexity. `A
4950

5051
```typescript
5152
login() {
52-
this.afAuth.auth.signInWithPopup(new GoogleAuthProvider());
53+
this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
5354
}
5455
logout() {
5556
this.afAuth.auth.signOut();
@@ -70,10 +71,12 @@ import { Observable } from 'rxjs/Observable';
7071
import { AngularFireModule } from 'angularfire2';
7172
import { AngularFireDatabaseModule, AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
7273
import { AngularFireAuthModule, AngularFireAuth } from 'angularfire2/auth';
73-
import { GoogleAuthProvider } from 'firebase/auth';
74-
import { User } from 'firebase';
7574
import { environment } from '../environments/environment';
7675

76+
// Do not import from 'firebase' as you'd lose the tree shaking benefits
77+
import * from 'firebase/app';
78+
79+
7780
@NgModule({
7881
declarations: [ App ],
7982
exports: [ App ],
@@ -96,14 +99,14 @@ export class MyModule { }
9699
`
97100
})
98101
export class App {
99-
user: Observable<User>;
102+
user: Observable<firebase.User>;
100103
items: FirebaseListObservable<any[]>;
101104
constructor(afAuth: AngularFireAuth, db: AngularFireDatabase) {
102105
this.user = afAuth.authState;
103106
this.items = db.list('items');
104107
}
105108
login() {
106-
this.afAuth.auth.signInWithPopup(new GoogleAuthProvider());
109+
this.afAuth.auth.signInWithPopup(new firebase.auth.GoogleAuthProvider());
107110
}
108111
logout() {
109112
this.afAuth.auth.signOut();

0 commit comments

Comments
 (0)