AngularJS Example

HTML

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<div ng-app="transclude">
  <div ng-controller="Ctrl">
      <heading><span>{{foo}}</span></heading>
  </div>
</div>

JavaScript

function Ctrl($scope) {
  $scope.foo = 'Bar';
}

angular.module('transclude', [])
 .directive('heading', function(){
    return {
      restrict: 'E',
      replace: true,
      transclude: true,
      scope: true,
      template: '<h1 ng-transclude></h1>'
    };
});