Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Angular JS as a templating engine?

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>
like image 899
Dan Kanze Avatar asked Dec 28 '12 16:12

Dan Kanze


1 Answers

You can use the ngInclude directive. The documentation and an example can be found here: http://docs.angularjs.org/api/ng.directive:ngInclude

like image 53
Wouter Avatar answered Sep 23 '22 07:09

Wouter