I am trying to reverse engineer an application - and re-write it in a way to get rid of the deferredBootstrapper. I am running into module loading issues etc... am I invokling multiple modules correctly in the standard sense? The task at hand is simplify the application without the bootstrapper.
here is the initial deferredBootstrapper app.js code
app.init = function (callback) {
angular.element(document).ready(function() {
//for async test loading
if (callback) {
callback();
} else {
deferredBootstrapper.bootstrap({
element: document,
module: "ECP",
injectorModules: ["ng", "ECP.services"],
resolve: {
LOAD_CONFIG: [
"$http", "$q", "Account", "Layout",
function($http, $q, Account, Layout) {
var configObj,
deferred;
configObj = {
account: null,
layout: null
};
deferred = $q.defer();
Account.fetch()
.then(function() {
configObj.account = Account;
return Layout.fetch();
})
.then(function() {
configObj.layout = Layout;
return deferred.resolve(configObj);
});
return deferred.promise;
}
]
}
});
}
});
};
and I am trying to use this documentation as a base http://beletsky.net/2013/11/using-angular-dot-js-with-require-dot-js.html
var app = angular.module("ECP", ["ng", "ECP.services"]);
app.init = function () {
angular.bootstrap(document, ["ECP"]);
};
app.config(["$http", "$q", "Account", "Layout",
function ($http, $q, Account, Layout) {
var configObj,
deferred;
configObj = {
account: null,
layout: null
};
deferred = $q.defer();
Account.fetch()
.then(function() {
configObj.account = Account;
return Layout.fetch();
})
.then(function() {
configObj.layout = Layout;
return deferred.resolve(configObj);
});
return deferred.promise;
}
]);
but I am running into a cascade of errors. How do I restore the functionality without deferredBootstrapper
you mean like this
Account.fetch()
.then(function() {
configObj.account = Account;
return Layout.fetch();
})
.then(function() {
configObj.layout = Layout;
return deferred.resolve(configObj);
})
.finally(function(){
return deferred.promise;
});