Angular: ng-include scope
http://angularjs.org/
by mrajcok
HTML
<script type="text/ng-template" id="/tpl1.html">
<form ng-submit="addLine()">
<input type="text" ng-model="$parent.lineText" size="30" placeholder="Type your message here">
</form>
</script>
<div ng-controller="HomeCtrl">
<div ng-include src="'/tpl1.html'"></div>
{{lines}}
</div>
JavaScript
var myApp = angular.module('myApp', []);
function HomeCtrl($scope) {
$scope.lines = [];
$scope.addLine = function(lineText) {
//$scope.chat.addLine($scope.lineText);
$scope.lines.push({
text: $scope.lineText
});
$scope.lineText = ''
};
}