diff options
| author | Matias Niemelä | 2013-04-02 19:41:16 -0400 |
|---|---|---|
| committer | Igor Minar | 2013-04-03 17:40:15 -0700 |
| commit | 19f1801379104bc1f74fbb9d288f71034ba829c9 (patch) | |
| tree | eaf2d28c5056b80669b33478c808df88431d6a4e /docs/src/example.js | |
| parent | 303df9dafee4314e5cfbc805f3321f4f4297a41a (diff) | |
| download | angular.js-19f1801379104bc1f74fbb9d288f71034ba829c9.tar.bz2 | |
docs: add animations into docs and directive examples
Diffstat (limited to 'docs/src/example.js')
| -rw-r--r-- | docs/src/example.js | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/docs/src/example.js b/docs/src/example.js index 7477b0a5..eadc218f 100644 --- a/docs/src/example.js +++ b/docs/src/example.js @@ -57,12 +57,27 @@ exports.Example.prototype.addSource = function(name, content) { } }; +exports.Example.prototype.enableAnimations = function() { + this.animations = true; +}; + +exports.Example.prototype.disableAnimations = function() { + this.animations = false; +}; + exports.Example.prototype.toHtml = function() { - return '<h2>Source</h2>\n' + - this.toHtmlEdit() + - this.toHtmlTabs() + - '<h2>Demo</h2>\n' + - this.toHtmlEmbed(); + var html = "<h2>Source</h2>\n"; + html += this.toHtmlEdit(); + html += this.toHtmlTabs(); + if(this.animations) { + html += '<div class="pull-right">'; + html += ' <button class="btn btn-primary" ng-click="animationsOff=true" ng-hide="animationsOff">Animations on</button>'; + html += ' <button class="btn btn-primary disabled" ng-click="animationsOff=false" ng-show="animationsOff">Animations off</button>'; + html += '</div>'; + } + html += "<h2>Demo</h2>\n"; + html += this.toHtmlEmbed(); + return html; }; @@ -116,7 +131,10 @@ exports.Example.prototype.toHtmlTabs = function() { exports.Example.prototype.toHtmlEmbed = function() { var out = []; - out.push('<div class="well doc-example-live"'); + out.push('<div class="well doc-example-live animator-container"'); + if(this.animations) { + out.push(" ng-class=\"{'animations-off':animationsOff == true}\""); + } out.push(' ng-embed-app="' + this.module + '"'); out.push(' ng-set-html="' + this.html[0].id + '"'); out.push(' ng-eval-javascript="' + ids(this.js) + '">'); |
