Templates cache

http://angularjs.org/

HTML

<script src="http://code.angularjs.org/angular-1.0.0rc12.js"></script>
<script type="text/ng-template" id="test1" src="https://tools.ietf.org/html/rfc1918">inside</script>
<script type="text/ng-template" id="test2" src="https://tools.ietf.org/html/rfc1918"></script>

<div ng-controller="MyCtrl">
  Select:
<a href ng:click="tpl='first.html'">internal</a>
     | <a href ng:click="tpl='test1'">script inside</a>
     | <a href ng:click="tpl='test2'">script external</a>
    <div style="border: 1px solid;min-height: 20px"><ng:include src="tpl"></ng:include></div>
</div>

JavaScript

var myApp = angular.module('myApp', []);

function MyCtrl($scope, $templateCache) {
    $templateCache.put('first.html', 'First template');
}