Created
August 31, 2016 06:44
-
-
Save cgonzalezdai/744e2818ba165a1c247c4b4457d7c351 to your computer and use it in GitHub Desktop.
Ejemplo básico de promesa.
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 promesa = new Promise (function (resolve, reject) { | |
//consulta asíncrona angular | |
$http(consulta).success(function (resp){ | |
// hacemos cosas con la respuesta de la consulta | |
resolve(true); | |
}).error(function() { | |
reject(false); | |
}) | |
}); | |
promesa.then(function(resp) { | |
// hacemos cosas despues de obtener la respuesta de la promesa | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment