angular.js - angular加载模板的方式
淡淡烟草味
淡淡烟草味 2017-05-15 16:55:00
0
1
502

$scope.initData = function() {

    //预加载项
    $templateCache.removeAll(); //移除所有模板内容,释放内存
    $templateCache.put('templates/main/decorateChooseTem.html', utils.getTemplates('templates/main/decorateChooseTem.html')); //列表选择模板
    $templateCache.put('templates/main/houseInputTem.html', utils.getTemplates('templates/main/houseInputTem.html')); //小区自动完成模板
    $templateCache.put('templates/main/numberInputTem.html', utils.getTemplates('templates/main/numberInputTem.html')); //输入数字模板
    $templateCache.put('templates/main/descosTem.html', utils.getTemplates('templates/main/descosTem.html'));
    $templateCache.put('templates/main/descontactTem.html', utils.getTemplates('templates/main/descontactTem.html'));

我用的是预加载模板,但是$templateCache.put(,);这种方式存在弊端。当长时间不动时,会让你重新加载。有什么好的方式加载吗? 刚学习,最好能有个demo

淡淡烟草味
淡淡烟草味

Antworte allen(1)
習慣沉默

可以试试ng-include

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!