diff options
| author | Igor Minar | 2010-11-05 21:12:37 -0700 |
|---|---|---|
| committer | Igor Minar | 2010-11-09 22:27:31 -0800 |
| commit | 324694a58b6d0ed33e05b511be4767573d9187dd (patch) | |
| tree | 0b7243e721da17e9b5c5a1111ed9c0d28829b309 /src/Angular.js | |
| parent | effcd340e9d41a2ab8368e4de06a1a83a206ac32 (diff) | |
| download | angular.js-324694a58b6d0ed33e05b511be4767573d9187dd.tar.bz2 | |
Better example widget
- syntax highlighting
- tabless design
- rename widget to doc:example
- rename widget files (wiki_widget.* -> doc_widget.*)
- example section is now optional
Diffstat (limited to 'src/Angular.js')
| -rw-r--r-- | src/Angular.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/Angular.js b/src/Angular.js index 9934b401..985d7bc4 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -165,9 +165,11 @@ var _undefined = undefined, * # Syntax * Attach a validator on user input widgets using the `ng:validate` attribute. * - * <WIKI:SOURCE> + * <doc:example> + * <doc:source> * Change me: <input type="text" name="number" ng:validate="integer" value="123"> - * </WIKI:SOURCE> + * </doc:source> + * </doc:example> * * # Writing your own Validators * Writing your own validator is easy. To make a function available as a @@ -255,6 +257,11 @@ var _undefined = undefined, * the DOM in addition to transforming the input. * * + * @exampleDescription + * The following example filter reverses a text string. In addition, it conditionally makes the + * text upper-case (to demonstrate optional arguments) and assigns color (to demonstrate DOM + * modification). + * * @example <script type="text/javascript"> angular.filter('reverse', function(input, uppercase, color) { @@ -271,11 +278,6 @@ var _undefined = undefined, return out; }); </script> - The following example filter reverses a text string. In addition, it conditionally makes the - text upper-case (to demonstrate optional arguments) and assigns color (to demonstrate DOM - modification). - - <hr/> <span ng:non-bindable="true">{{"hello"|reverse}}</span>: {{"hello"|reverse}}<br> <span ng:non-bindable="true">{{"hello"|reverse:true}}</span>: {{"hello"|reverse:true}}<br> <span ng:non-bindable="true">{{"hello"|reverse:true:"blue"}}</span>: @@ -340,20 +342,22 @@ var _undefined = undefined, * } * }); * </script> + * * Formatted: <input type="text" name="data" value="<angular/>" ng:format="reverse"/><br/> * Stored: <input type="text" name="data"/><br/> * <pre>{{data}}</pre> + * * * @scenario * it('should store reverse', function(){ - * expect(element('.example :input:first').val()).toEqual('<angular/>'); - * expect(element('.example :input:last').val()).toEqual('>/RALUGNA<'); + * expect(element('.doc-example input:first').val()).toEqual('<angular/>'); + * expect(element('.doc-example input:last').val()).toEqual('>/RALUGNA<'); * * this.addFutureAction('change to XYZ', function($window, $document, done){ - * $document.elements('.example :input:last').val('XYZ').trigger('change'); + * $document.elements('.doc-example input:last').val('XYZ').trigger('change'); * done(); * }); - * expect(element('.example :input:first').val()).toEqual('zyx'); + * expect(element('input:first').val()).toEqual('zyx'); * }); */ angularFormatter = extensionMap(angular, 'formatter'), |
