diff options
Diffstat (limited to 'docs/src/templates/doc_widgets.js')
| -rw-r--r-- | docs/src/templates/doc_widgets.js | 59 |
1 files changed, 32 insertions, 27 deletions
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) { '</div>'; 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( - '<li><a href="#!/tutorial/' + prevStep + '">Previous</a></li>' + - '<li><a href="http://angular.github.com/angular-phonecat/step-' + step + '/app">Live Demo</a></li>' + - '<li><a href="https://github.com/angular/angular-phonecat/compare/' + codeDiff + '">Code Diff</a></li>' + - '<li><a href="#!/tutorial/' + nextStep + '">Next</a></li>' - ); + content = angular.element( + '<li><a href="#!/tutorial/' + prevStep + '">Previous</a></li>' + + '<li><a href="http://angular.github.com/angular-phonecat/step-' + step + '/app">Live Demo</a></li>' + + '<li><a href="https://github.com/angular/angular-phonecat/compare/' + codeDiff + '">Code Diff</a></li>' + + '<li><a href="#!/tutorial/' + nextStep + '">Next</a></li>' + ); - element.attr('id', 'tutorial-nav'); - element.append(content); + element.attr('id', 'tutorial-nav'); + element.append(content); + } }; function pad(step) { |
