【问题标题】:I made a button with ionic2. but it doesn't work at all. I added the codes我用ionic2做了一个按钮。但它根本不起作用。我添加了代码
【发布时间】:2017-04-13 03:39:49
【问题描述】:

我制作了一个与使用 facebook 登录相关的按钮。

当我点击按钮时,它根本不起作用。

我添加了代码。

我该怎么办?

请帮帮我!

【问题讨论】:

  • 非常感谢。因为有你的帮助,我的团队项目一定很成功!!
  • 我有一个 Git 仓库,我在上面实现了基于云的插件。如果您需要它,请告诉我。我可以与您分享。
  • 对不起,你能告诉我一些关于我的代码的 cmets 吗?坦率地说,我找不到解决这个问题的提示。我可以拿你的 git repo 吗?非常感谢你:)

标签: facebook angular button ionic2


【解决方案1】:

我已经做到了,它在真实设备上运行良好。如果您有任何问题,请在下方评论。

Git Repo

Cloud Plugin for more info.

注意:在 git repo 上叉出并使用它。

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();
  }

}

【讨论】:

  • 感谢您的帮助。我想我可以解决这个问题。非常感谢。
  • 这是我的荣幸 :)
猜你喜欢
  • 2022-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-19
相关资源
最近更新 更多