Last active
May 1, 2017 04:31
-
-
Save Igor-Lopes/8fdac5531672e85aeadf19724f6cbc8c to your computer and use it in GitHub Desktop.
Simple Promise example
This file contains hidden or 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 getTime(date) { | |
return $q(function(resolve, reject) { | |
resolve(date.getTime()); | |
}); | |
} | |
var promise = getTime(new Date()); | |
promise.then(function(data) { | |
//Code here | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment