diff options
| author | Misko Hevery | 2012-03-07 22:47:01 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2012-03-08 10:07:49 -0800 | 
| commit | 6a98c52c847ecc620118f3ccfdd66c3956c0fb01 (patch) | |
| tree | 722ac5c8f1a847ba62c242fb60f2bc1a417120f8 /docs/src/templates/doc_widgets.js | |
| parent | 6aa3cfc31b14bfe74d89030fb6c2d615e44f2845 (diff) | |
| download | angular.js-6a98c52c847ecc620118f3ccfdd66c3956c0fb01.tar.bz2 | |
chore(compiler): change default restriction to attribute only for directives
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) { | 
