// model tree panelApp.directive('batMtree', function($compile) { return { restrict: 'E', terminal: true, scope: { val: '=val', edit: '=edit', inspect: '=inspect' }, link: function (scope, element, attrs) { // this is more complicated then it should be // see: https://github.com/angular/angular.js/issues/898 element.append( '
' + 'Scope ({{val.id}}) | ' + 'toggle' + '
' + '' + '
' + '' + '
' + '
' + '
'); $compile(element.contents())(scope.$new()); } }; });