@@ -17,22 +17,22 @@ services if needed.
1717
1818Like other core angular variables and identifiers, the built-in services always start with `$`.
1919
20- * ` {@link angular.service.$browser $browser}`
21- * ` {@link angular.service.$window $window}`
22- * ` {@link angular.service.$document $document}`
23- * ` {@link angular.service.$location $location}`
24- * ` {@link angular.service.$log $log}`
25- * ` {@link angular.service.$exceptionHandler $exceptionHandler}`
26- * ` {@link angular.service.$hover $hover}`
27- * ` {@link angular.service.$invalidWidgets $invalidWidgets}`
28- * ` {@link angular.service.$route $route}`
29- * ` {@link angular.service.$xhr $xhr}`
30- * ` {@link angular.service.$xhr.error $xhr.error}`
31- * ` {@link angular.service.$xhr.bulk $xhr.bulk}`
32- * ` {@link angular.service.$xhr.cache $xhr.cache}`
33- * ` {@link angular.service.$resource $resource}`
34- * ` {@link angular.service.$cookies $cookies}`
35- * ` {@link angular.service.$cookieStore $cookieStore}`
20+ * {@link angular.service.$browser $browser}
21+ * {@link angular.service.$window $window}
22+ * {@link angular.service.$document $document}
23+ * {@link angular.service.$location $location}
24+ * {@link angular.service.$log $log}
25+ * {@link angular.service.$exceptionHandler $exceptionHandler}
26+ * {@link angular.service.$hover $hover}
27+ * {@link angular.service.$invalidWidgets $invalidWidgets}
28+ * {@link angular.service.$route $route}
29+ * {@link angular.service.$xhr $xhr}
30+ * {@link angular.service.$xhr.error $xhr.error}
31+ * {@link angular.service.$xhr.bulk $xhr.bulk}
32+ * {@link angular.service.$xhr.cache $xhr.cache}
33+ * {@link angular.service.$resource $resource}
34+ * {@link angular.service.$cookies $cookies}
35+ * {@link angular.service.$cookieStore $cookieStore}
3636
3737# Writing your own custom services
3838angular provides only set of basic services, so for any nontrivial application it will be necessary
@@ -138,29 +138,38 @@ myController.$inject = ['$location', '$log'];
138138</pre>
139139
140140@example
141- <script type="text/javascript">
142- angular.service('notify', function(win) {
143- var msgs = [];
144- return function(msg) {
145- msgs.push(msg);
146- if (msgs.length == 3) {
147- win.alert(msgs.join("\n"));
148- msgs = [];
149- }
150- };
151- }, {$inject: ['$window']});
152-
153- function myController(notifyService) {
154- this.callNotify = function(msg) {
155- notifyService(msg);
156- };
157- }
158-
159- myController.$inject = ['notify'];
160- </script>
161-
162- <div ng:controller="myController">
163- <p>Let's try this simple notify service, injected into the controller...</p>
164- <input ng:init="message='test'" type="text" name="message" />
165- <button ng:click="callNotify(message);">NOTIFY</button>
166- </div>
141+ <doc:example>
142+ <doc:source>
143+ <script type="text/javascript">
144+ angular.service('notify', function(win) {
145+ var msgs = [];
146+ return function(msg) {
147+ msgs.push(msg);
148+ if (msgs.length == 3) {
149+ win.alert(msgs.join("\n"));
150+ msgs = [];
151+ }
152+ };
153+ }, {$inject: ['$window']});
154+
155+ function myController(notifyService) {
156+ this.callNotify = function(msg) {
157+ notifyService(msg);
158+ };
159+ }
160+
161+ myController.$inject = ['notify'];
162+ </script>
163+
164+ <div ng:controller="myController">
165+ <p>Let's try this simple notify service, injected into the controller...</p>
166+ <input ng:init="message='test'" type="text" name="message" />
167+ <button ng:click="callNotify(message);">NOTIFY</button>
168+ </div>
169+ </doc:source>
170+ <doc:scenario>
171+ it('should test service', function(){
172+ expect(element(':input[name=message]').val()).toEqual('test');
173+ });
174+ </doc:scenario>
175+ </doc:example>
0 commit comments