Skip to content

Instantly share code, notes, and snippets.

@abhiaiyer91
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhiaiyer91/9419c3a12f17dc94e2a7 to your computer and use it in GitHub Desktop.
Save abhiaiyer91/9419c3a12f17dc94e2a7 to your computer and use it in GitHub Desktop.
var app = angular.module('PromisesStillAllSoWastedOnMyself', []);
app.controller('YouCtrl', function(TextFromBuddyService){
//Some code goes here
var BuddyTextPromise = function () {
//Your buddy promised to Text you, so this service returns a promise
TextFromBuddyService.getUpdate()
//promise function method: success() or failure()
.success(function(update){
if (update.girl==='Jeannie') {
getReady();
} else {
study();
}
})
.failure(function(error){
study();
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment