angularjs – 使用ng-include和模板缓存
发布时间:2020-12-17 17:06:38 所属栏目:安全 来源:网络整理
导读:我正在开发角js.以前,我使用ng-include和url.但是我怎么能将url指向templatecache? ng-include src="string" [onload="string"] [autoscroll="string"].../ng-include 解决方法 模板缓存使用密钥来标识缓存的元素,因此您可以使用密钥. $templateCache.put('
我正在开发角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. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |