Last active
November 7, 2015 13:48
-
-
Save yngvebn/f716fd42332aef113a0a 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
function startPromise(){ | |
var promise = $q.defer(); | |
var i = 0; | |
$interval(function(){ | |
i++; | |
promise.notify(i); | |
if(i === 10){ | |
promise.resolve(i); | |
} | |
}, 500); | |
return promise.promise; | |
} | |
startPromise().then( | |
function(data) { console.log('resolved '+data)}, | |
function(data) { console.log('rejected '+data)}, | |
function(data) { console.log('progress '+data)}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment