@@ -34,7 +34,8 @@ In 4.0 we've reduced the complexity of the auth module by providing only a [`fir
34
34
35
35
``` typescript
36
36
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' ;
38
39
...
39
40
40
41
user : Observable < firebase .User > ;
@@ -49,7 +50,7 @@ While convenient, the pre-configured login feature added unneeded complexity. `A
49
50
50
51
``` typescript
51
52
login () {
52
- this .afAuth .auth .signInWithPopup (new GoogleAuthProvider ());
53
+ this .afAuth .auth .signInWithPopup (new firebase . auth . GoogleAuthProvider ());
53
54
}
54
55
logout () {
55
56
this .afAuth .auth .signOut ();
@@ -70,10 +71,12 @@ import { Observable } from 'rxjs/Observable';
70
71
import { AngularFireModule } from ' angularfire2' ;
71
72
import { AngularFireDatabaseModule , AngularFireDatabase , FirebaseListObservable } from ' angularfire2/database' ;
72
73
import { AngularFireAuthModule , AngularFireAuth } from ' angularfire2/auth' ;
73
- import { GoogleAuthProvider } from ' firebase/auth' ;
74
- import { User } from ' firebase' ;
75
74
import { environment } from ' ../environments/environment' ;
76
75
76
+ // Do not import from 'firebase' as you'd lose the tree shaking benefits
77
+ import * from ' firebase/app' ;
78
+
79
+
77
80
@NgModule ({
78
81
declarations: [ App ],
79
82
exports: [ App ],
@@ -96,14 +99,14 @@ export class MyModule { }
96
99
`
97
100
})
98
101
export class App {
99
- user: Observable <User >;
102
+ user: Observable <firebase . User >;
100
103
items: FirebaseListObservable <any []>;
101
104
constructor (afAuth : AngularFireAuth , db : AngularFireDatabase ) {
102
105
this .user = afAuth .authState ;
103
106
this .items = db .list (' items' );
104
107
}
105
108
login() {
106
- this .afAuth .auth .signInWithPopup (new GoogleAuthProvider ());
109
+ this .afAuth .auth .signInWithPopup (new firebase . auth . GoogleAuthProvider ());
107
110
}
108
111
logout() {
109
112
this .afAuth .auth .signOut ();
0 commit comments