Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何调用FacebookAPI提取数据并预先填充表单_Angularjs_Facebook - Fatal编程技术网

Angularjs 如何调用FacebookAPI提取数据并预先填充表单

Angularjs 如何调用FacebookAPI提取数据并预先填充表单,angularjs,facebook,Angularjs,Facebook,我正在做一个注册表格,在那里我调用facebook API获取一些数据,并用所需的数据填写我的表格。我在控制器中执行smth,如下所示: $scope.fbRegister = function () { facebookConnectPlugin.getLoginStatus(function (success) { if (!cordova) { //this is for browser o

我正在做一个注册表格,在那里我调用facebook API获取一些数据,并用所需的数据填写我的表格。我在控制器中执行smth,如下所示:

$scope.fbRegister = function () {

            facebookConnectPlugin.getLoginStatus(function (success) {

                if (!cordova) {
                    //this is for browser only
                    facebookConnectPlugin.browserInit(FACEBOOK_APP_ID);
                }
                alert(JSON.stringify(success, null, 3));
                if (success.status === 'connected') {
                    // the user is logged in and has authenticated your app, and response.authResponse supplies
                    // the user's ID, a valid access token, a signed request, and the time the access token
                    // and signed request each expire

                    facebookConnectPlugin.api("me/?fields=id,first_name,last_name,link,gender,email,birthday", ["public_profile", "email", "user_birthday"],
                        function(result) {
                            alert("Result: " + JSON.stringify(result));
                            alert(result.first_name);


        $scope.formData = {
            name: result.first_name,
            password: "",
            confirmPassword: "",
            email: '',
        };
        })
        }
但是,我没有在
name:result.first\u name,
中获取带前缀的数据。 我对此发出了警告,我得到了数据,但我无法将其填入表格


感谢您使用console.log进行调试,而不是警报。例如console.log(result),我在这里得到数据:
alert(“result:+JSON.stringify(result));警报(结果、名称)但是这里的'name:result.first_name','我没有得到任何东西,正如我所说的,不要使用alert进行调试。这是一种非常糟糕的调试方式。因为我在使用alert的设备上调试。。。但是当我使用控制台时,结果是一样的,这到底是什么结果?您没有向我们显示console.log(result)的结果。你真的需要弄清楚如何在移动设备上调试。如果是安卓系统,那就很容易了。正如我所说,警报是最糟糕的调试方式。