@@ -43,9 +43,19 @@ Now that you have a new project setup, install AngularFire2 and Firebase from np
4343
4444### 4. Add Firebase config to environments variable
4545
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:
4847
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+ ```
4959
5060
5161### 5. Setup @NgModule for the AngularFireModule
@@ -60,15 +70,7 @@ import { IonicApp, IonicModule } from 'ionic-angular';
6070import { MyApp } from ' ./app.component' ;
6171
6272import { 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' ;
7274
7375@NgModule ({
7476 declarations: [ MyApp ],
@@ -121,17 +123,10 @@ import { IonicApp, IonicModule } from 'ionic-angular';
121123import { MyApp } from ' ./app.component' ;
122124
123125import { AngularFireModule } from ' angularfire2' ;
126+ import { firebaseConfig } from ' ../environment' ;
124127import { AngularFireDatabaseModule } from ' angularfire2/database' ;
125128import { AngularFireAuthModule } from ' angularfire2/auth' ;
126129
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- }
135130
136131@NgModule ({
137132 declarations: [ MyApp ],
0 commit comments