From 6a98c52c847ecc620118f3ccfdd66c3956c0fb01 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 7 Mar 2012 22:47:01 -0800 Subject: chore(compiler): change default restriction to attribute only for directives --- docs/src/templates/doc_widgets.js | 59 +++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'docs/src/templates/doc_widgets.js') diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js index 5d4f8905..acbdae4f 100644 --- a/docs/src/templates/doc_widgets.js +++ b/docs/src/templates/doc_widgets.js @@ -25,6 +25,7 @@ angular.module('ngdocs.directives', [], function($compileProvider) { $compileProvider.directive('docExample', ['$injector', '$log', '$browser', '$location', function($injector, $log, $browser, $location) { return { + restrict: 'E', terminal: true, compile: function(element, attrs) { var module = attrs.module; @@ -238,6 +239,7 @@ angular.module('ngdocs.directives', [], function($compileProvider) { ''; return { + restrict: 'EA', compile: function(element, attrs) { var tabs = angular.element(HTML_TPL.replace('{show}', attrs.show || 'false')), nav = tabs.find('ul'), @@ -268,35 +270,38 @@ angular.module('ngdocs.directives', [], function($compileProvider) { $compileProvider.directive('docTutorialNav', function() { - return function(scope, element, attrs) { - var prevStep, codeDiff, nextStep, - content, step = attrs.docTutorialNav; - - step = parseInt(step, 10); - - if (step === 0) { - prevStep = ''; - nextStep = 'step_01'; - codeDiff = 'step-0~7...step-0'; - } else if (step === 11){ - prevStep = 'step_10'; - nextStep = 'the_end'; - codeDiff = 'step-10...step-11'; - } else { - prevStep = 'step_' + pad(step - 1); - nextStep = 'step_' + pad(step + 1); - codeDiff = 'step-' + step + '...step-' + step; - } + return { + restrict: 'EA', + link:function(scope, element, attrs) { + var prevStep, codeDiff, nextStep, + content, step = attrs.docTutorialNav; + + step = parseInt(step, 10); + + if (step === 0) { + prevStep = ''; + nextStep = 'step_01'; + codeDiff = 'step-0~7...step-0'; + } else if (step === 11){ + prevStep = 'step_10'; + nextStep = 'the_end'; + codeDiff = 'step-10...step-11'; + } else { + prevStep = 'step_' + pad(step - 1); + nextStep = 'step_' + pad(step + 1); + codeDiff = 'step-' + step + '...step-' + step; + } - content = angular.element( - '