body-col.directive.js

app.directive('lwBodyCol', ['$compile', function ($compile) { return { restrict: 'E', templateUrl: 'lw-body-col.html', scope: false, compile: function (templateElement, templateAttributes) { var templateDirectiveContent = templateElement.contents().remove(); var compiledContent; return function ($scope, linkElement, linkAttributes) { if (!compiledContent) { compiledContent = $compile(templateDirectiveContent); } compiledContent($scope, function (clone) { linkElement.append(clone); }); }; } }; }]);
Directive recursion: a directive that uses itself in its template.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.