Last active
August 29, 2015 14:02
-
-
Save abhiaiyer91/9419c3a12f17dc94e2a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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