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="testvalue" /><p/>
Print testvalue: <b>{{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.testvalue= "initial value";
$scope.show = function(){
alert($scope.testvalue);
}
}