This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 1 file changed +38
-2
lines changed
1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -192,8 +192,44 @@ function $CacheFactoryProvider() {
192
192
* @name ng.$templateCache
193
193
*
194
194
* @description
195
- * Cache used for storing html templates.
196
- *
195
+ * The first time a template is used, it is loaded in the tempalte cache for quick retrieval. You can
196
+ * load templates directly into the cache in a `script` tag, or by consuming the `$templateCache`
197
+ * service directly.
198
+ *
199
+ * Adding via the `script` tag:
200
+ * <pre>
201
+ * <html ng-app>
202
+ * <head>
203
+ * <script type="text/ng-template" id="templateId.html">
204
+ * This is the content of the template
205
+ * </script>
206
+ * </head>
207
+ * ...
208
+ * </html>
209
+ * </pre>
210
+ *
211
+ * **Note:** the `script` tag containing the template does not need to be included in the `head` of the document, but
212
+ * it must be below the `ng-app` definition.
213
+ *
214
+ * Adding via the $templateCache service:
215
+ *
216
+ * <pre>
217
+ * var myApp = angular.module('myApp', []);
218
+ * myApp.run(function($templateCache) {
219
+ * $templateCache.put('templateId.html', 'This is the content of the template');
220
+ * });
221
+ * </pre>
222
+ *
223
+ * To retrieve the template later, simply use it in your HTML:
224
+ * <pre>
225
+ * <div ng-include=" 'templateId.html' "></div>
226
+ * </pre>
227
+ *
228
+ * or get it via Javascript:
229
+ * <pre>
230
+ * $templateCache.get('templateId.html')
231
+ * </pre>
232
+ *
197
233
* See {@link ng.$cacheFactory $cacheFactory}.
198
234
*
199
235
*/
You can’t perform that action at this time.
0 commit comments