I really need some data to be loaded before bootstrapping angular. For this reason I've created a run
block/ Within this run
block I call a method on a service which load some data from the server. Since this is a async call, JavaScript gets further with execution, which results in some undefined objects in my app.
I am working with routes, but it is not an option to work with the resolve
property.
Could someone provide a solution on how to wait for a promise to be ready in the run
block?
EDIT:
Thanks to the given answers, I have solved it by manually bootstrapping angular:
$(document).ready(function () {
$.ajax('/Data/GetDropdownData', {type:'POST'}).done(function (response) {
app.run(['ListService', function (ListService) {
ListService.setData(response);
}])
angular.bootstrap(document, ["sma"]);
})
})