2016-07-05 15 views
0

私は火災基地で作業していますが、残念ながら私がrespUserをコンソールに置いたときに[object object]を与えた場合、私はJSON.Stringifyを入力しようとしました。 JSONに、円形の構造は、その後、私は変換するのにangular.toJsonを使用しますが、それはそう私を助けてください動作しませんでした、 は、以下の私のコード..あなたが作成するための「文字列化」を使用する必要がありJsonに変換するときにエラーが発生しました

$scope.logIn = function() { 

    firebase.auth().signInWithEmailAndPassword($scope.email, $scope.password).then(function (user) { 
    console.log(user); 

    $scope.populateUserLocally(user); 
     }).catch(function (error) { 
    var errorCode = error.code; 
    var errorMessage = error.message; 
    console.log(errorMessage); 
    });}; 



    $scope.populateUserLocally = function (respUser) { 
    $scope.userDetails = angular.toJson(respUser); console.log("$scope.userDetails"); }; 
+0

あなたは 'respUser.val()'を使用するべきです –

+0

あなたはplunkrを提供できますか –

答えて

1

事前に

おかげでありますJSON文字列

$scope.userDetails = JSON.stringify(respUser); 
+0

私はJSON.stringify(respUser)を試しましたが、それはできませんでした。 –

関連する問題