How to start AngularFire2 with Ionic2?


#1

How to start AngularFire2 with Ionic2 ?
i make project with Ionic2 and now i need to connect with fire-base.
it getting more difficult to use it with firebase and typescript .
i did lots of search it seems new Ionic versions not compatible with it using simple nmp install


#2

Hi there

try https://github.com/tja4472/ionic-angularfire

hth
Tim


#3

Firebase module not defined
I reported issue in your git repo


#4

I got it working. Probably you have not included the module correctly? This is my code:

import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { Page1 } from '../pages/page1/page1';
import { Page2 } from '../pages/page2/page2';
import { AngularFireModule, AuthProviders, AuthMethods } from 'angularfire2';

// Must export the config
export const firebaseConfig = {
  apiKey: "KEY",
  authDomain: "domain.com",
  databaseURL: "https://yourdatabase.firebaseio.com",
  storageBucket: "yourbucket.appspot.com",
  messagingSenderId: "your id"
};

const myFirebaseAuthConfig = {
  provider: AuthProviders.Google,
  method: AuthMethods.Redirect
}

@NgModule({
  declarations: [
MyApp,
Page1,
Page2
  ],
  imports: [
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(firebaseConfig, myFirebaseAuthConfig)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
MyApp,
Page1,
Page2
  ],
  providers: []
})
export class AppModule { }

#5

@almgwary You are currently using node 4.4.5.

Ionic suggests you use node 6 or greater


#6

The best source I’ve found for this is the writing of Jorge Vergara. You might want to start here.


#7

if i have time i will fork your repo and add more features to you then make pull request to you
thanks it working now