AngularJS ng-include

by Liam Krewer

HTML

<div ng-controller="Ctrl">
    <label> First Name: <input ng-model="name.first" /></label>
    <br />
    <label> Last Name: <input ng-model="name.last" /></label>
    <br />
    <br />
    <div class="template" ng-include src="'template.html'"></div>
  </div>
  
<!-- template -->
<script type="text/ng-template" id="template.html">
    Name: <b>{{name.first}} {{name.last}}</b>
    
</script>

CSS

.template {
    border: 2px solid red
}

JavaScript

function Ctrl($scope) {
    $scope.name = {first: "John",last: "Doe"};
}