diff --git a/src/angularfire2.spec.ts b/src/angularfire2.spec.ts index 15c38361d..2c7afc571 100644 --- a/src/angularfire2.spec.ts +++ b/src/angularfire2.spec.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { TestBed, inject diff --git a/src/angularfire2.ts b/src/angularfire2.ts index cbc01fa75..ab68aea94 100644 --- a/src/angularfire2.ts +++ b/src/angularfire2.ts @@ -1,4 +1,4 @@ -import { initializeApp } from 'firebase'; +import * as firebase from 'firebase'; import * as utils from './utils'; import { FirebaseAppConfig } from './interfaces'; import { AuthConfiguration } from './auth'; @@ -49,7 +49,7 @@ export class AngularFire { } export function _getFirebase(config: FirebaseAppConfig): firebase.app.App { - return initializeApp(config); + return firebase.initializeApp(config); } export function _getWindowLocation(){ diff --git a/src/auth/auth.spec.ts b/src/auth/auth.spec.ts index 885355e17..9e0031ab5 100644 --- a/src/auth/auth.spec.ts +++ b/src/auth/auth.spec.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { auth, initializeApp } from 'firebase'; import { ReflectiveInjector, Provider } from '@angular/core'; import { Observable } from 'rxjs/Observable' diff --git a/src/auth/auth.ts b/src/auth/auth.ts index 21157f74b..40b52b399 100644 --- a/src/auth/auth.ts +++ b/src/auth/auth.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { Provider, Inject, Injectable, Optional } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; diff --git a/src/auth/auth_backend.spec.ts b/src/auth/auth_backend.spec.ts index 5c29eca2e..abedf975f 100644 --- a/src/auth/auth_backend.spec.ts +++ b/src/auth/auth_backend.spec.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { authDataToAuthState, AuthProviders, diff --git a/src/auth/auth_backend.ts b/src/auth/auth_backend.ts index b5da7020d..881e70e5a 100644 --- a/src/auth/auth_backend.ts +++ b/src/auth/auth_backend.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { Observable } from 'rxjs/Observable'; export abstract class AuthBackend { diff --git a/src/auth/firebase_sdk_auth_backend.ts b/src/auth/firebase_sdk_auth_backend.ts index b5ba557f5..b609c49b7 100644 --- a/src/auth/firebase_sdk_auth_backend.ts +++ b/src/auth/firebase_sdk_auth_backend.ts @@ -1,9 +1,9 @@ +import * as firebase from 'firebase'; import { Injectable, Inject } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { Observer } from 'rxjs/Observer'; import { FirebaseApp } from '../tokens'; import { isPresent, ZoneScheduler } from '../utils'; -import { auth } from 'firebase'; import { authDataToAuthState, AuthBackend, @@ -18,7 +18,7 @@ const { GithubAuthProvider, GoogleAuthProvider, TwitterAuthProvider -} = auth; +} = firebase.auth; import { map } from 'rxjs/operator/map'; import { fromPromise } from 'rxjs/observable/fromPromise'; diff --git a/src/database/database.ts b/src/database/database.ts index d2ee4c12d..8927c0344 100644 --- a/src/database/database.ts +++ b/src/database/database.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { Inject, Injectable } from '@angular/core'; import { FirebaseApp, FirebaseConfig } from '../tokens'; import { FirebaseAppConfig } from '../angularfire2'; diff --git a/src/database/firebase_list_factory.spec.ts b/src/database/firebase_list_factory.spec.ts index 94beeda19..142517be1 100644 --- a/src/database/firebase_list_factory.spec.ts +++ b/src/database/firebase_list_factory.spec.ts @@ -1,4 +1,4 @@ -declare var require: any; +import * as firebase from 'firebase'; import { FirebaseListFactory, FirebaseListObservable, diff --git a/src/database/firebase_list_factory.ts b/src/database/firebase_list_factory.ts index 74454bee1..39fbcf0bc 100644 --- a/src/database/firebase_list_factory.ts +++ b/src/database/firebase_list_factory.ts @@ -1,7 +1,7 @@ +import * as firebase from 'firebase'; import { AFUnwrappedDataSnapshot } from '../interfaces'; import { FirebaseListObservable } from './firebase_list_observable'; import { Observer } from 'rxjs/Observer'; -import { database } from 'firebase'; import { observeQuery } from './query_observable'; import { Query, FirebaseListFactoryOpts } from '../interfaces'; import * as utils from '../utils'; @@ -17,7 +17,7 @@ export function FirebaseListFactory ( let ref: firebase.database.Reference | firebase.database.Query; utils.checkForUrlOrFirebaseRef(absoluteUrlOrDbRef, { - isUrl: () => ref = database().refFromURL(absoluteUrlOrDbRef), + isUrl: () => ref = firebase.database().refFromURL(absoluteUrlOrDbRef), isRef: () => ref = absoluteUrlOrDbRef, isQuery: () => ref = absoluteUrlOrDbRef, }); diff --git a/src/database/firebase_list_observable.spec.ts b/src/database/firebase_list_observable.spec.ts index 7c0e8b384..25bb8e5b4 100644 --- a/src/database/firebase_list_observable.spec.ts +++ b/src/database/firebase_list_observable.spec.ts @@ -1,7 +1,7 @@ import { FirebaseListObservable } from './index'; import { Observer } from 'rxjs/Observer'; import { map } from 'rxjs/operator/map'; -import { database } from 'firebase'; +import * as firebase from 'firebase'; import { unwrapMapFn } from '../utils'; import { FIREBASE_PROVIDERS, @@ -30,7 +30,7 @@ describe('FirebaseObservable', () => { }); inject([FirebaseApp, AngularFire], (firebaseApp: firebase.app.App, _af: AngularFire) => { app = firebaseApp; - ref = database().ref(); + ref = firebase.database().ref(); O = new FirebaseListObservable(ref, (observer:Observer) => { }); })(); diff --git a/src/database/firebase_object_factory.spec.ts b/src/database/firebase_object_factory.spec.ts index d26e8e0cb..499329525 100644 --- a/src/database/firebase_object_factory.spec.ts +++ b/src/database/firebase_object_factory.spec.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { Subscription } from 'rxjs'; import { FirebaseObjectFactory, FirebaseObjectObservable } from './index'; import { diff --git a/src/database/firebase_object_factory.ts b/src/database/firebase_object_factory.ts index 844a9f055..9c2a5371c 100644 --- a/src/database/firebase_object_factory.ts +++ b/src/database/firebase_object_factory.ts @@ -1,6 +1,6 @@ import { FirebaseObjectObservable } from './index'; import { Observer } from 'rxjs/Observer'; -import { database } from 'firebase'; +import * as firebase from 'firebase'; import * as utils from '../utils'; import { Query } from '../interfaces'; import { observeQuery } from './query_observable'; @@ -13,7 +13,7 @@ export function FirebaseObjectFactory ( let ref: firebase.database.Reference; utils.checkForUrlOrFirebaseRef(absoluteUrlOrDbRef, { - isUrl: () => ref = database().refFromURL(absoluteUrlOrDbRef), + isUrl: () => ref = firebase.database().refFromURL(absoluteUrlOrDbRef), isRef: () => ref = absoluteUrlOrDbRef }); diff --git a/src/database/firebase_object_observable.spec.ts b/src/database/firebase_object_observable.spec.ts index fa19bc60b..b963db3c7 100644 --- a/src/database/firebase_object_observable.spec.ts +++ b/src/database/firebase_object_observable.spec.ts @@ -14,7 +14,7 @@ import { COMMON_CONFIG, ANON_AUTH_CONFIG } from '../test-config'; import { FirebaseObjectObservable } from './index'; import { Observer } from 'rxjs/Observer'; import { map } from 'rxjs/operator/map'; -import { database } from 'firebase'; +import * as firebase from 'firebase'; const rootDatabaseUrl = COMMON_CONFIG.databaseURL; @@ -30,7 +30,7 @@ describe('FirebaseObjectObservable', () => { }); inject([FirebaseApp, AngularFire], (firebaseApp: firebase.app.App, _af: AngularFire) => { app = firebaseApp; - ref = database().ref() + ref = firebase.database().ref() O = new FirebaseObjectObservable((observer:Observer) => { }, ref); })(); diff --git a/src/interfaces.ts b/src/interfaces.ts index a5ea53d9c..f7ef1bbc9 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { Observable } from 'rxjs/Observable'; export interface FirebaseAppConfig { diff --git a/src/utils.ts b/src/utils.ts index aa9fd2293..be08ff875 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,3 +1,4 @@ +import * as firebase from 'firebase'; import { Subscription } from 'rxjs/Subscription'; import { Scheduler } from 'rxjs/Scheduler'; import { queue } from 'rxjs/scheduler/queue';