【发布时间】:2016-07-05 11:41:00
【问题描述】:
我正在研究火力基地,但不幸的是,我遇到了一个问题,当我将 respUser 放入控制台时,它给出了 [object object],然后我尝试输入 JSON.Stringify,它给了我一个类型错误:转换圆形结构到 Json 然后我用 angular.toJson 转换但它没有工作所以请帮助我,
下面是我的代码..
提前致谢
$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"); };
【问题讨论】:
-
你应该使用
respUser.val() -
你能提供你的 plunkr
标签: angularjs firebase firebase-authentication