我正在开发角js.以前,我使用ng-include和url.但是我怎么能将url指向templatecache?
<ng-include src="string" [onload="string"] [autoscroll="string"]> ... </ng-include>
解决方法
模板缓存使用密钥来标识缓存的元素,因此您可以使用密钥.
$templateCache.put('MY KEY','Cached content');
并在HTML中:
<ng-include src="'MY KEY'"></ng-include>
请参阅AngularJS docs for $templateCache.