javascript - What is the first parameter in Parse.User.signUp()? -
i'm using parse.com database of app , signup view, i'm trying reduce number of lines in code.
user.set("username",$scope.user.email); user.set("email",$scope.user.email); user.set("password",$scope.user.password); user.signup(null, { success: function(user) { $ionicloading.hide(); $scope.state.success = true; }, error: function(user, error) { $ionicloading.hide(); if (error.code == 125) { $scope.error.message = "please specify valid email address"; } else if (error.code == 202) { $scope.error.message = "the email address registered"; } else { $scope.error.message = error.message; } $scope.$apply(); } });
my question this: first parameter supposed be? on parse.com, not use examples first parameter null (that have seen). , cannot find docs explain .signup()
method detail.
my instinct tells me parameter expects user data in json format. don't know sure.
edit: solution:
var user = new parse.user(); user.signup({ "username": $scope.user.email, "email": $scope.user.email, "password": $scope.user.password }, { success: function(user) { $ionicloading.hide(); $scope.state.success = true; }, error: function(user, error) { $ionicloading.hide(); if (error.code == 125) { $scope.error.message = "please specify valid email address"; } else if (error.code == 202) { $scope.error.message = "the email address registered"; } else { $scope.error.message = error.message; } $scope.$apply(); } });
Comments
Post a Comment