用angular登录后获取facebook详细信息

时间:2016-07-16 09:13:17

标签: javascript angularjs facebook ionic-framework

我正在尝试在我的角度应用程序中实现facebook登录。登录工作正常,但问题是在登录后我想提醒来自Facebook的数据,但我遇到了问题。

.controller('facebook_login',['$scope', '$ionicModal', '$timeout', 'ngFB', function($scope, $ionicModal, $timeout, ngFB) {
 $scope.fbLogin = function () {
    ngFB.login({scope: 'email,public_profile,publish_actions'}).then(
        function (response) {
            if (response.status === 'connected') {
                //alert('Facebook login succeeded, got access token: ' + response.authResponse.accessToken);
                //$scope.closeLogin();
                 ngFB.api({
                 path: '/me',
                 params: {fields: 'id,name'}
                 }).then(
                 function (user) {
            $scope.user = user;
            alert(params)
       });
            } else {
                alert('Facebook login failed');
            }
        });
};

}])

1 个答案:

答案 0 :(得分:1)

请尝试将params:字段更改为以下

private void button3_Click(object sender, EventArgs e)
{
    string[] val = new string[] { comboBox2.Text, textBox5.Text, textBox4.Text };
    // if the Adapter has changed here
    // the dataset might hold different states
    // so it might hold on Update where an Insert is needed
    // in that case use some logic to Fill a new Dataset and merge that
    // with the current one
    this.Adapter.Update(this.localDataSet1); // the values from the dataset will be stored.
}

不是在params上调用警报,而是在响应对象(即这种情况下的用户)上发出警报。

fields: 'first_name,last_name,gender,email,picture'