I have an angular app that I am manually bootstrap so I can get config data from the server before the app starts up. The problem is I need an id param from the url to pass to the server in order to get the config data.
Is there a way to use angular to harvest some url params while I bootstrap the app? I need a param for the $http.get url.
fetchData().then(bootstrapApplication);
function fetchData() {
var initInjector = angular.injector(["ng"]);
var $http = initInjector.get("$http");
return $http.get("/path/to/data.json").then(function (response) {
angular.module('app').constant("config", response.data);
}, function (errorResponse) {
// Handle error case
});
}
function bootstrapApplication() {
// manually bootstrap the app
angular.element(document).ready(function () {
var reportingApp = document.getElementById('ClaimSummaryApp');
angular.bootstrap(reportingApp, ['app']);
});
}