In our module.run, we make a promise-based call to code like this:
load: function () {
var deferred = $q.defer();
$http({
url : 'config.json',
method: 'GET'
})
.success(function (data) {
configData = data;
deferred.resolve();
}
).error(function () {
deferred.reject('Sorry we couldn\'t configure the
application for you.');
});
return deferred.promise;
},
If it succeeds, the app runs, if it fails, the app dies gracefully.
All caveats apply regarding security and UX.
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
angular+u...@googlegroups.com.
> To post to this group, send email to
ang...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/angular.
> For more options, visit
https://groups.google.com/groups/opt_out.
--
Grant Rettke | ACM, AMA, COG, IEEE
gre...@acm.org |
http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson