AngularJS Tutorial - ng-include includes inline template








The following code shows how to use ng-include to include an inline template.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--  w  w  w . ja v  a2s.c  o m-->
<body>
  <div ng-app="">
  <script type="text/ng-template" id="/tpl.html">
      I am from a template.
  </script>
  <ng-include src="'/tpl.html'"></ng-include>
</div>  
</body>
</html>

The code above is rendered as follows: