Created
May 25, 2016 13:07
-
-
Save oddlyfunctional/25fa67259ee71b7bb9926cca8ba58b2c to your computer and use it in GitHub Desktop.
$timeout with nested callbacks
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
$timeout(function() { | |
if (!$scope.promiseComplete && $scope.submitted) { | |
$scope.message = { | |
content: [{ | |
title: '', | |
msg: 'Service down - created' | |
}], | |
type: 'error' | |
}; | |
$timeout(function() { | |
$scope.message = null; | |
$timeout(function() { | |
if (userDidntChangeAnything()) { | |
$scope.message = { | |
content: [{ | |
title: '', | |
msg: 'Do you need any help? Talk to our support in our online chat!' | |
}], | |
type: 'notification' | |
}; | |
$timeout(function() { | |
$scope.message = null; | |
}, 2000); | |
} | |
}, 5000); | |
}, 2000); | |
} | |
}, 5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment