angular transclusion

by Aswin Devarajan

HTML

<test-dir>
  <p class='content'>the script</p>
</test-dir>

JavaScript

var app = angular.module('myApp', []);
app.controller('mainCtrl', function() {
  console.log('viva')
});


app.directive('testDir', function() {
  return {
    restrict: 'AE',
    transclude: true,
    template: "<p>viva la vida</p><div ng-transclude></div>",
    link: function(scope, elem, attrs, ctrl, transclude){
    	elem.find('.content').append(transclude());
      console.log("after the append");
    }
  };
});