diff options
| author | Misko Hevery | 2011-11-08 17:40:52 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:15 -0800 | 
| commit | 9c0639437607a4fcea379bbaf610600d05d8a9b7 (patch) | |
| tree | 1ae90d93d0139f7791487fe814360904254d39cb /docs/content/guide/dev_guide.services.injecting_controllers.ngdoc | |
| parent | 085e3c611fd0cd48757702c50c67b551a00a0d38 (diff) | |
| download | angular.js-9c0639437607a4fcea379bbaf610600d05d8a9b7.tar.bz2 | |
chore(scenario tests): make scenario tests pass again
Diffstat (limited to 'docs/content/guide/dev_guide.services.injecting_controllers.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.services.injecting_controllers.ngdoc | 24 | 
1 files changed, 13 insertions, 11 deletions
| diff --git a/docs/content/guide/dev_guide.services.injecting_controllers.ngdoc b/docs/content/guide/dev_guide.services.injecting_controllers.ngdoc index d58f2c3c..56823eb9 100644 --- a/docs/content/guide/dev_guide.services.injecting_controllers.ngdoc +++ b/docs/content/guide/dev_guide.services.injecting_controllers.ngdoc @@ -31,16 +31,18 @@ myController.$inject = ['$location', '$log'];  <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']}); +angular.module.MyServiceModule = ['$provide', function($provide){ +  $provide.factory('notify', ['$window', function(win) { +    var msgs = []; +    return function(msg) { +      msgs.push(msg); +      if (msgs.length == 3) { +        win.alert(msgs.join("\n")); +        msgs = []; +      } +    }; +  }]); +}];  function myController(notifyService) {    this.callNotify = function(msg) { @@ -51,7 +53,7 @@ function myController(notifyService) {  myController.$inject = ['notify'];  </script> -<div ng:controller="myController"> +<div ng:controller="myController" ng:module="MyServiceModule">  <p>Let's try this simple notify service, injected into the controller...</p>  <input ng:init="message='test'" type="text" ng:model="message" />  <button ng:click="callNotify(message);">NOTIFY</button> | 
