Skip to content

Instantly share code, notes, and snippets.

@oddlyfunctional
Created May 25, 2016 13:13
Show Gist options
  • Save oddlyfunctional/7598b8a30361c40a99376fdb550f0926 to your computer and use it in GitHub Desktop.
Save oddlyfunctional/7598b8a30361c40a99376fdb550f0926 to your computer and use it in GitHub Desktop.
$timeout as promises
$timeout(function() {
if (!$scope.promiseComplete && $scope.submitted) {
$scope.message = {
content: [{
title: '',
msg: 'Service down - created'
}],
type: 'error'
};
$timeout(function() {
$scope.message = null;
}, 2000).then(function() {
return $timeout(function() {
if (userDidntChangeAnything()) {
$scope.message = {
content: [{
title: '',
msg: 'Do you need any help? Talk to our support in our online chat!'
}],
type: 'notification'
};
}
}, 5000);
}).then(function() {
return $timeout(function() {
$scope.message = null;
}, 2000);
});
}
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment