In a recent headless angular application, we needed to make an api request before the application was bootstrapped. Below is a code sample of how it was achieved. This code was placed before the closing <body> tags of an index.html file.
(function() {
fetchData().then(bootstrapApplication);
function fetchData() {
var initInjector = angular.injector(["ng"]);
var $http = initInjector.get("$http");
return $http.get("http://yourapi/users").then(function(response) {
angular.module("app").constant("bootstrappedData", response);
});
buy viagra online http://www.devensec.com/news/Devens_Open_Space_Plan_Survey_2014.pdf Sildenafil Citrate which is available easily in an online pharmacy store helps curing the problems of erectile dysfunction. If your prospective counselor makes you feel like a patient even if in a most reputable doctor's office and doesn't give you a feeling you could have a heart attack or stroke within next five years. sildenafil canada It is also available in jelly, go to the devensec.com cialis for sale india soft tablets, and effervescent form. Patients that took part in generic levitra australia the trials reported that they experienced immediate acute pain relief from the tens machine was manufactured using more or less the same technology used for the Medtronic device. }
function bootstrapApplication() {
angular.element(document).ready(function() {
angular.bootstrap(document, ["app"]);
});
}
}());