I want to implement a promise in my code to run angular.bootstrap() in block 2 if 3 seconds has passed and angular.bootstrap() in block 1 has not been done, but only if.
I have two blocks of code:
// block 1:
Office.initialize = function (reason) {
$(document).ready(function () {
angular.bootstrap(document, ['myApp'])
})
}
// block 2:
$(document).ready(function () {
angular.bootstrap(document, ['myApp'])
})
Does anyone know how to do this?
Edit 1: Just to clarify that it is possible that Office.initialize is never executed (ie, when the app is loaded in Office as an add-in). In this case, I still want to execute angular.bootstrap of block 2 in 3 seconds.