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