我已经阅读了 $templateCache 的文档,但我仍然在努力理解如何使用 put 函数将远程模板加载到缓存中。
下面是一个例子:
onBoardingApp.run(function ($templateCache, $http) {
$templateCache.put('tpl1.html', '<p>Hello World</p>');
$templateCache.put('tpl2.html', '~/Templates/Pi/pi-1.html');
alert($templateCache.get('tpl1.html'));
alert($templateCache.get('tpl2.html'));
});
虽然我的代码返回 tpl1 的 HTML 代码,但正在返回 tpl2 的路径。我的问题是:如何使用 $templatecache.put() 加载远程模板。
谢谢您的帮助。