Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ng-include with template cache

Tags:

angularjs

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

<ng-include
  src="string"
  [onload="string"]
  [autoscroll="string"]>
...
</ng-include>
like image 931
desmondlee Avatar asked Nov 29 '22 23:11

desmondlee


1 Answers

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.

like image 56
Ron Dadon Avatar answered Dec 11 '22 01:12

Ron Dadon