首页 > 解决方案 > 浏览器错误上的离子facebook firebase应用程序

问题描述

当我在浏览器上运行 ionic 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>    

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

标签: ionic-framework

解决方案


推荐阅读