AngularJS ng-include
HTML
<div ng-controller="Ctrl">
<div ng-include src="'template.html'"></div>
</div>
<!-- template -->
<script type="text/ng-template" id="template.html">
<input ng-model="foo.testvalue" /><p/>
Print testvalue: <b>{{foo.testvalue}}</b>
<p/>
<a href="#" ng-click="show()">Show testvalue</a><p/>
(this should alert the updated value, but instead it always shows the initial value. Why?)
</script>
JavaScript
function Ctrl($scope) {
$scope.foo = {testvalue: "initial value"};
$scope.show = function(){
alert($scope.foo.testvalue);
}
}