Skip to content

Instantly share code, notes, and snippets.

@RubyRonin
Created September 30, 2015 20:09
Show Gist options
  • Save RubyRonin/604f058993ffb8d2f6b5 to your computer and use it in GitHub Desktop.
Save RubyRonin/604f058993ffb8d2f6b5 to your computer and use it in GitHub Desktop.
user.signup function question
.controller('LoginCtrl', function($scope, $state) {
$scope.data = {};
$scope.signupEmail = function(){
//Create a new user on Pasre
var user = new Parse.User();
user.set("username", $scope.data.username);
user.set("password", $scope.data.password);
user.set("email", $scope.data.email);
user.signUp(null, {
success: function(user) {
alert("sucess!");
$state.go('dashboard'); //causes app to change "state" or "view" upon success, required the injection of $state
},
error: function(user, error) {
alert("Error: " + error.code + " " +error.message);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment