diff options
| author | Misko Hevery | 2011-01-31 16:21:29 -0800 |
|---|---|---|
| committer | Misko Hevery | 2011-02-01 10:00:09 -0800 |
| commit | ba6b68b6ae2bb2400a75ca2834fee47bfd60f1c6 (patch) | |
| tree | 94f08ee16f270dd5f6238fb77064c91c624df931 /docs/angular.service.ngdoc | |
| parent | ed768ebc53ef6746ca83d81892c22d2e9c3afeef (diff) | |
| download | angular.js-ba6b68b6ae2bb2400a75ca2834fee47bfd60f1c6.tar.bz2 | |
changed the documentation @example to use <doc:example>
Diffstat (limited to 'docs/angular.service.ngdoc')
| -rw-r--r-- | docs/angular.service.ngdoc | 93 |
1 files changed, 51 insertions, 42 deletions
diff --git a/docs/angular.service.ngdoc b/docs/angular.service.ngdoc index 4e4810f9..0d3406e5 100644 --- a/docs/angular.service.ngdoc +++ b/docs/angular.service.ngdoc @@ -17,22 +17,22 @@ services if needed. Like other core angular variables and identifiers, the built-in services always start with `$`. - * `{@link angular.service.$browser $browser}` - * `{@link angular.service.$window $window}` - * `{@link angular.service.$document $document}` - * `{@link angular.service.$location $location}` - * `{@link angular.service.$log $log}` - * `{@link angular.service.$exceptionHandler $exceptionHandler}` - * `{@link angular.service.$hover $hover}` - * `{@link angular.service.$invalidWidgets $invalidWidgets}` - * `{@link angular.service.$route $route}` - * `{@link angular.service.$xhr $xhr}` - * `{@link angular.service.$xhr.error $xhr.error}` - * `{@link angular.service.$xhr.bulk $xhr.bulk}` - * `{@link angular.service.$xhr.cache $xhr.cache}` - * `{@link angular.service.$resource $resource}` - * `{@link angular.service.$cookies $cookies}` - * `{@link angular.service.$cookieStore $cookieStore}` + * {@link angular.service.$browser $browser} + * {@link angular.service.$window $window} + * {@link angular.service.$document $document} + * {@link angular.service.$location $location} + * {@link angular.service.$log $log} + * {@link angular.service.$exceptionHandler $exceptionHandler} + * {@link angular.service.$hover $hover} + * {@link angular.service.$invalidWidgets $invalidWidgets} + * {@link angular.service.$route $route} + * {@link angular.service.$xhr $xhr} + * {@link angular.service.$xhr.error $xhr.error} + * {@link angular.service.$xhr.bulk $xhr.bulk} + * {@link angular.service.$xhr.cache $xhr.cache} + * {@link angular.service.$resource $resource} + * {@link angular.service.$cookies $cookies} + * {@link angular.service.$cookieStore $cookieStore} # Writing your own custom services angular provides only set of basic services, so for any nontrivial application it will be necessary @@ -138,29 +138,38 @@ myController.$inject = ['$location', '$log']; </pre> @example -<script type="text/javascript"> - angular.service('notify', function(win) { - var msgs = []; - return function(msg) { - msgs.push(msg); - if (msgs.length == 3) { - win.alert(msgs.join("\n")); - msgs = []; - } - }; - }, {$inject: ['$window']}); - - function myController(notifyService) { - this.callNotify = function(msg) { - notifyService(msg); - }; - } - - myController.$inject = ['notify']; -</script> - -<div ng:controller="myController"> -<p>Let's try this simple notify service, injected into the controller...</p> -<input ng:init="message='test'" type="text" name="message" /> -<button ng:click="callNotify(message);">NOTIFY</button> -</div> +<doc:example> + <doc:source> + <script type="text/javascript"> + angular.service('notify', function(win) { + var msgs = []; + return function(msg) { + msgs.push(msg); + if (msgs.length == 3) { + win.alert(msgs.join("\n")); + msgs = []; + } + }; + }, {$inject: ['$window']}); + + function myController(notifyService) { + this.callNotify = function(msg) { + notifyService(msg); + }; + } + + myController.$inject = ['notify']; + </script> + + <div ng:controller="myController"> + <p>Let's try this simple notify service, injected into the controller...</p> + <input ng:init="message='test'" type="text" name="message" /> + <button ng:click="callNotify(message);">NOTIFY</button> + </div> + </doc:source> + <doc:scenario> + it('should test service', function(){ + expect(element(':input[name=message]').val()).toEqual('test'); + }); + </doc:scenario> +</doc:example> |
