Skip to content

Instantly share code, notes, and snippets.

@thebigredgeek
Created October 7, 2013 17:39
Show Gist options
  • Save thebigredgeek/6871855 to your computer and use it in GitHub Desktop.
Save thebigredgeek/6871855 to your computer and use it in GitHub Desktop.
FBase.prototype.register = function(email, password) {
var killFailureListener, killSuccessListener, promise, self;
this.regDeferral = _q.defer();
self = this;
promise = this.regDeferral.promise;
killSuccessListener = null;
killFailureListener = null;
killSuccessListener = _rootScope.$once("angularFireAuth:login", function(event, user) {
killFailureListener();
console.log("hello");
self.regDeferral.resolve(user);
return true;
});
killFailureListener = _rootScope.$once("angularFireAuth:error", function(event, err) {
killSuccessListener();
self.regDeferral.reject(err);
return true;
});
_auth.createUser(email, password);
return promise.then(function() {
return console.log("world!");
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment