Improve this Doc View Source $templateRequest
- service in module ng
The $templateRequest service runs security checks then downloads the provided template using $http and, upon success, stores the contents inside of $templateCache. If the HTTP request fails or the response data of the HTTP request is empty, a $compile error will be thrown (the exception can be thwarted by setting the 2nd parameter of the function to true). Note that the contents of $templateCache are trusted, so the call to $sce.getTrustedUrl(tpl) is omitted when tpl is of type string and $templateCache has the matching entry.
Usage
$templateRequest(tpl, [ignoreRequestError]);
Arguments
| Param | Type | Details |
|---|---|---|
| tpl | stringTrustedResourceUrl | The HTTP request template URL |
| ignoreRequestError (optional) | boolean | Whether or not to ignore the exception when the request fails or the template is empty |
Returns
Promise |
a promise for the HTTP response data of the given URL. |
Properties
-
totalPendingRequests
numbertotal amount of pending template requests being downloaded.
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://code.angularjs.org/1.4.14/docs/api/ng/service/$templateRequest