我正在与Facebook整合,以便应用程序用户使用facebook登录。 我正在测试离子2的文档代码,但每次丢失错误条件时它都无法正常工作。还有什么要做的吗?
import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import { RecuperarSenhaPage } from '../recuperar-senha/recuperar-senha';
import { CadastroUsuarioPage } from '../cadastro-usuario/cadastro-usuario';
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
import { BrowserModule } from '@angular/platform-browser';
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
constructor(public navCtrl: NavController,
public navParams: NavParams,
private _fb: Facebook) {
}
loginFacebook() {
this._fb.login(['email'])
.then((res: FacebookLoginResponse) => console.log('Logged into Facebook!', res))
.catch(e => console.log('Error logging into Facebook', JSON.stringify(e)));
}
}