Skip to content

Instantly share code, notes, and snippets.

@bleathem
Created October 3, 2014 19:31
Show Gist options
  • Save bleathem/d57ab0ca227f1dafb01c to your computer and use it in GitHub Desktop.
Save bleathem/d57ab0ca227f1dafb01c to your computer and use it in GitHub Desktop.
The commit where I "got" javascript promises.
@@ -64,15 +64,7 @@
};
return function(authWindow) {
- var deferred = $q.defer();
- getCodePromise(authWindow).then(function(code) {
- getTokenPromise(code).then(function(data) {
- deferred.resolve(data);
- }, function(error) {
- deferred.reject(error);
- });
- });
- return deferred.promise;
+ return getCodePromise(authWindow).then(getTokenPromise);
};
}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment