Skip to content

Instantly share code, notes, and snippets.

@xcarpentier
Last active August 29, 2015 14:07
Show Gist options
  • Save xcarpentier/eb0fe96fd634c3bd7911 to your computer and use it in GitHub Desktop.
Save xcarpentier/eb0fe96fd634c3bd7911 to your computer and use it in GitHub Desktop.
/* Recommandé */
activate();
function activate() {
/**
* Etape 1
* Demande les données et attend la promesse
*/
return getAvengers().then(function() {
/**
* Etape 4
* Effectuer une action sur la détermination de la promesse finale
*/
logger.info('Activated Avengers View');
});
}
function getAvengers() {
/**
* Etape 2
* Demande au service les données et attend la promesse
*/
return dataservice.getAvengers()
.then(function (data) {
/**
* Etape 3
* Défini les données et résoud la promesse
*/
vm.avengers = data;
return vm.avengers;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment