2017-04-13 21 views
0

我做了一個與facebook登錄相關的按鈕。我用ionic2製作了一個按鈕。但它根本不起作用。我添加了代碼

當我點擊按鈕時,它根本不起作用。

我添加了代碼。

enter image description here enter image description here

我應該怎麼辦? enter image description here

請幫幫我!

+0

這是你所期望的嗎? https://docs.ionic.io/services/auth/facebook-native.html – Sampath

+0

非常感謝你。因爲你的幫助,我的團隊項目必須非常成功! – stick

+0

我有一個Git倉庫,我在上面實現了基於雲的插件。如果你需要它,請告訴我,我可以與你分享。 – Sampath

回答

0

我已經做到了,它在真實設備上工作正常。如果您有任何問題,請在下面評論。

Git Repo

Cloud Plugin for more info

注意:叉以上git回購和玩它。

app.module.ts

import { CloudSettings, CloudModule } from '@ionic/cloud-angular'; 

const cloudSettings: CloudSettings = { 
    'core': { 
    'app_id': 'd32c02d2' 
    }, 
    'auth': { 
    'facebook': { 
     'scope': ['public_profile', 'email'] 
    } 
    } 
}; 

@NgModule({ 
    declarations: [ 
    ], 
    imports: [ 
    CloudModule.forRoot(cloudSettings) 
    ], 
    bootstrap: [IonicApp], 
    entryComponents: [ 
    ], 
    providers: [ 

    ] 
}) 
export class AppModule { } 

home.html做爲

<button ion-button block type="button" (click)="fbLogin()">Fb Login</button> 

home.ts

import { Component } from '@angular/core'; 
import { FacebookAuth, User } from '@ionic/cloud-angular'; 


@Component({ 
    selector: 'page-home', 
    templateUrl: 'home.html' 
}) 
export class HomePage { 

    constructor(public facebookAuth: FacebookAuth, public user: User) { 

    } 

    fbLogin() { 
    this.facebookAuth.login(); 
    } 

} 
+1

我感謝你的幫助。我想我可以解決這個問題。非常感謝。 – stick

+0

這是我的榮幸:) – Sampath

相關問題