desmondlee desmondlee - 1 year ago 244
AngularJS Question

Using ng-include with template cache

I am developing in angular js. Previously, i use ng-include with url. But how could i point the url to templatecache?


Answer Source

Template cache uses a key for identifying the cached elements, so you can use the key for that.

  $templateCache.put('MY KEY', 'Cached content');

And in the html:

<ng-include src="'MY KEY'"></ng-include>

See it on AngularJS docs for $templateCache.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download