如何使用角度JS作为模板引擎? [英] How do I use Angular JS as a templating engine?
问题描述
本 <一个href=\"http://stackoverflow.com/questions/12346690/is-there-a-way-to-make-angularjs-load-partials-in-the-beginning-and-not-at-when\">post进入细节如何绑定的事件装载模板谐音。
但是,如果我想在页面加载的负载模板谐音 similair像Smarty的模板引擎?
什么的例如在Smarty的:的
&LT; HTML和GT;
&LT;身体GT;
{包括文件=模板/ header.html中}
&LT;跨度&GT;好家伙,这也有可能在角JS ...&LT; / SPAN&GT;
{包括文件=模板/ footer.html}
&LT; /身体GT;
&LT; / HTML&GT;
您可以使用ngInclude指令。该文档和例子可以在这里找到:<一href=\"http://docs.angularjs.org/api/ng.directive:ngInclude\">http://docs.angularjs.org/api/ng.directive:ngInclude
This post goes into detail how to bind loading template partials on events.
But what if I wanted to load template partials on page load similair to a templating engine like Smarty?
For example in Smarty:
<html>
<body>
{include file="templates/header.html"}
<span>Dude, this has too be possible in Angular JS...</span>
{include file="templates/footer.html"}
</body>
</html>
You can use the ngInclude directive. The documentation and an example can be found here: http://docs.angularjs.org/api/ng.directive:ngInclude
这篇关于如何使用角度JS作为模板引擎?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!