2016-06-25 7 views
2

habe ich versucht, ein Beispiel appangularfire 2: Fehler "Nicht behandelte Versprechen Ablehnung: Typeerror: kann nicht lesen Eigenschaft"

In meinem Main.ts ich dies schrieb Feuerbasis zu verbinden:

EDIT
import { bootstrap } from '@angular/platform-browser-dynamic'; 
import { enableProdMode } from '@angular/core'; 
import { AppComponent, environment } from './app/'; 
import { FIREBASE_PROVIDERS, defaultFirebase, firebaseAuthConfig, AuthProviders, AuthMethods } from 'angularfire2'; 

if (environment.production) { 
    enableProdMode(); 
} 

bootstrap(AppComponent,[ 
    FIREBASE_PROVIDERS, 
    defaultFirebase({ 
    apiKey: "MYKEY", 
    authDomain: "MYDOMAIN.firebaseapp.com", 
    databaseURL: "https://MYDOMAN.firebaseio.com", 
    storageBucket: "MYDOMAIN.appspot.com", 
    }), 
    firebaseAuthConfig({ 
    provider: AuthProviders.Password, 
    method: AuthMethods.Popup 
    }) 
]); 

: hier ist die component.ts

import { Component } from '@angular/core'; 
import { LoginComponent } from './login/' 

@Component({ 
    moduleId: module.id, 
    selector: 'app-root', 
    templateUrl: 'app.component.html', 
    styleUrls: ['app.component.css'], 
    directives: [ LoginComponent ] 
}) 
export class AppComponent { 
    title = 'Please Login to the App'; 
} 

Aber wann ist meine App mit „ng dienen“ und rufen Sie die URL starten, bekomme ich einen Fehler genannt:

zone.js:461 Unhandled Promise rejection: TypeError: Cannot read property 'FacebookAuthProvider' of undefined at Object.eval (http://localhost:4200/vendor/angularfire2/providers/firebase_sdk_auth_backend.js:24:43) at eval (http://localhost:4200/vendor/angularfire2/providers/firebase_sdk_auth_backend.js:108:4) at eval (http://localhost:4200/vendor/angularfire2/providers/firebase_sdk_auth_backend.js:109:3) at Object.eval (http://localhost:4200/vendor/angularfire2/angularfire2.js:33:35) Evaluating http://localhost:4200/vendor/angularfire2/providers/firebase_sdk_auth_backend.js Evaluating http://localhost:4200/vendor/angularfire2/angularfire2.js Evaluating http://localhost:4200/app/login/login.component.js Evaluating http://localhost:4200/app/login/index.js Evaluating http://localhost:4200/app/app.component.js Evaluating http://localhost:4200/app/index.js Evaluating http://localhost:4200/main.js Error loading http://localhost:4200/main.js ; Zone: ; Task: Promise.then ; Value: Error: TypeError: Cannot read property 'FacebookAuthProvider' of undefined(…)

Irgendwelche Ideen?

+0

Wie sieht Ihre 'AppComponent' aus? – Michael

+0

'Main.ts' Datei ist in Ordnung, geben Sie uns den Code mit' FacebookAuthProvider' Komponente und Service, wenn Sie einen haben. –

+0

@Michael Ich habe den Beitrag bearbeitet. – Skary

Antwort

0

Basierend auf den Kommentaren scheint dieser Fehler bei der Verwendung des Firebase 2.x SDK anstelle des Firebase 3.x SDK, das von AngularFire2 benötigt wird.