@@ -43,9 +43,19 @@ Now that you have a new project setup, install AngularFire2 and Firebase from np
43
43
44
44
### 4. Add Firebase config to environments variable
45
45
46
- Your Firebase config can be added to the root ` src/app/app.module.ts ` or to it's own file.
47
- We'll use the root ` app.module.ts ` for this example.
46
+ Let's create a new file, ` src/environment.ts ` and start adding our Firebase config:
48
47
48
+ ``` ts
49
+ export const firebaseConfig = {
50
+ apiKey: ' <your-key>' ,
51
+ authDomain: ' <your-project-authdomain>' ,
52
+ databaseURL: ' <your-database-URL>' ,
53
+ projectId: ' <your-project-id>' ,
54
+ storageBucket: ' <your-storage-bucket>' ,
55
+ messagingSenderId: ' <your-messaging-sender-id>'
56
+ }
57
+
58
+ ```
49
59
50
60
51
61
### 5. Setup @NgModule for the AngularFireModule
@@ -60,15 +70,7 @@ import { IonicApp, IonicModule } from 'ionic-angular';
60
70
import { MyApp } from ' ./app.component' ;
61
71
62
72
import { AngularFireModule } from ' angularfire2' ;
63
-
64
- const firebaseConfig = {
65
- apiKey: ' <your-key>' ,
66
- authDomain: ' <your-project-authdomain>' ,
67
- databaseURL: ' <your-database-URL>' ,
68
- projectId: ' <your-project-id>' ,
69
- storageBucket: ' <your-storage-bucket>' ,
70
- messagingSenderId: ' <your-messaging-sender-id>'
71
- }
73
+ import { firebaseConfig } from ' ../environment' ;
72
74
73
75
@NgModule ({
74
76
declarations: [ MyApp ],
@@ -121,17 +123,10 @@ import { IonicApp, IonicModule } from 'ionic-angular';
121
123
import { MyApp } from ' ./app.component' ;
122
124
123
125
import { AngularFireModule } from ' angularfire2' ;
126
+ import { firebaseConfig } from ' ../environment' ;
124
127
import { AngularFireDatabaseModule } from ' angularfire2/database' ;
125
128
import { AngularFireAuthModule } from ' angularfire2/auth' ;
126
129
127
- const firebaseConfig = {
128
- apiKey: ' <your-key>' ,
129
- authDomain: ' <your-project-authdomain>' ,
130
- databaseURL: ' <your-database-URL>' ,
131
- projectId: ' <your-project-id>' ,
132
- storageBucket: ' <your-storage-bucket>' ,
133
- messagingSenderId: ' <your-messaging-sender-id>'
134
- }
135
130
136
131
@NgModule ({
137
132
declarations: [ MyApp ],
0 commit comments