如何加载在复杂的AngularJS应用程序模板 [英] How to load templates in complex AngularJS application
问题描述
什么是加载在复杂的应用AngularJS模板(多视图)的最好方法?
What is the best way to load templates in complex AngularJS application (many views)?
难道是总体有利加载的所有模板作为单个文件或加载他们的需求呢?
Would it be in general beneficial to load all templates as a single file or load them on demand?
是否AngularJS提供一种方法来捆绑所有模板在一个文件?可以在$ templateCache应用于此目的?
Does AngularJS provide a way to bundle all templates in one file? Can $templateCache be applied for this purpose?
推荐答案
这是通常使用的咕噜和html2js所有HTML模板文件转换成模板缓存。
It's common to use grunt and html2js to convert all of the HTML template files into the template cache.
NG-样板显示此设置在它的Gruntfile.js。 https://github.com/ngbp/ng-boilerplate 。
ng-boilerplate shows this setup in it's Gruntfile.js. https://github.com/ngbp/ng-boilerplate.
这是非常有益的,采取这种方式,减少HTTP的请求数的应用使得
It's hugely beneficial to take this approach and reduce the number of http requests your application makes.
这篇关于如何加载在复杂的AngularJS应用程序模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!