离子Facebook Firebase应用出现浏览器错误

时间:2019-04-01 18:38:30

标签: ionic-framework

当我在浏览器上运行离子Facebook firebase应用程序时,出现错误

HomePage.html:8 ERROR TypeError: Object(...) is not a function    
    at Facebook.login (index.js:27)    
    at HomePage.webpackJsonp.230.HomePage.loginWithFacebook (home.ts:20)    
    at Object.eval [as handleEvent] (HomePage.html:8)    
    at handleEvent (core.js:13589)    
    at callWithDebugContext (core.js:15098)    
    at Object.debugHandleEvent [as handleEvent] (core.js:14685)    
    at dispatchEvent (core.js:10004)    
    at core.js:10629    
    at HTMLButtonElement.<anonymous> (platform-browser.js:2628)    
    at t.invokeTask (polyfills.js:3)   

我的home.ts文件是

loginWithFacebook(): Promise<any> {    
    return this.facebook.login(['email'])    
      .then( response => {    
        const facebookCredential = firebase.auth.FacebookAuthProvider    
          .credential(response.authResponse.accessToken);   
        firebase.auth().signInWithCredential(facebookCredential)    
          .then( success => {      
            alert("Firebase success: " + JSON.stringify(success));     
           });    
      }).catch((error) => { console.log(error) });    
  }    

我的home.html文件是

<ion-content padding>     
  <button ion-button (click)="loginWithFacebook()">Login With Facebook</button>    
</ion-content>    

我真的被困在这里......

0 个答案:

没有答案