I want to use $document to grab a server value from an input field.
var base_url = $document[0].getElementById('BaseUrl').value;
The base url is used for grabbing templates.
var base_url = $document[0].getElementById('BaseUrl').value;
$routeProvider.when('/alert', {
controller: function () { },
templateUrl: base_url + '/partials/instances.html'
});
Since $document throws an error that it’s unknown I am guessing that it’s not available at config? Is there a way to find out what is available and what not? I could also use $http to get data from the server but that’s also not available.
AngularJS modules are bootstrapped in 2 phases:
Configuration phasewhere only providers and constants are available.Run phasewhere services are instantiated based on registered providers. In this phase constants are still available but not providers.The AngularJS documentation (section: “Module Loading & Dependencies”) gives the insight into this:
Given the above you can only inject constants and providers (marked with the
Providersuffix in the API docs). This probably answers your question but doesn’t help to solve your problem of templates loading…I wonder if you couldn’t simply use the base tag in HTML and then simply use relative paths (to the base) without specifying absolute paths? Sth like (provided that the base is correctly configured):