$templateRequest
Template request service
$templateRequest fetches templates through $http and stores successful
responses in $templateCache.
Configure template request defaults before bootstrap with
module.config({ $templateRequest: ... }).
angular.createModule("demo", []).config({
$templateRequest: {
httpOptions: {
headers: {
"X-Template": "configured",
},
withCredentials: true,
},
},
});
Executable sample:
template-request.html
Usage
$templateRequest("./panel.html").then((template) => {
$templateCache.set("panel.html", template);
});
$templateRequest assumes template URLs are trusted by the caller. Security
policy for resource URLs belongs to $compile.resourceUrlPolicy when templates
are loaded through compiler bindings such as ng-include.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.