Skip to content

Integration with AngularFire2

Minko Gechev edited this page Sep 20, 2016 · 11 revisions

This page shows how to integrate angularfire2 (angularfire2@2.0.0-beta.2 & firebase@3.1.0) into the seed.

  1. Install angularfire2 and firebase:
npm install --save angularfire2 firebase @types/request @types/firebase
  1. Declare the types for the dependencies in src/client/tsconfig.json:
"types": [
  "firebase",
  "angularfire2",
  "core-js",
  "express",
  "jasmine",
  "node",
  "protractor",
  "systemjs"
]
  1. In tools/config/project.config.ts, inside the ProjectConfig constructor:
constructor() {

    this.SYSTEM_CONFIG_DEV.paths['firebase'] =
      `${this.APP_BASE}node_modules/firebase/firebase`;

    this.SYSTEM_BUILDER_CONFIG.packages['firebase'] = {
        main: 'firebase.js',
        defaultExtension : 'js'
    };
  1. Use angularfire2!
import { FIREBASE_PROVIDERS, defaultFirebase } from 'angularfire2';

/* other imports/code */

bootstrap(AppComponent, [
  FIREBASE_PROVIDERS,
  defaultFirebase({
    apiKey: '<->',
    authDomain: '<->',
    databaseURL: '<->',
    storageBucket: '<->',
  })
]);