diff options
| author | Igor Minar | 2011-09-29 03:20:31 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-09-29 03:21:24 +0200 |
| commit | b7a7fc7065a7bd6031b82a748105cf0415cb68e4 (patch) | |
| tree | d7c8cdee07237a2368545d395808d27e81c24208 /src/service | |
| parent | 21b2a5bd212e600cbbf9212982ff556bbdb18e5f (diff) | |
| download | angular.js-b7a7fc7065a7bd6031b82a748105cf0415cb68e4.tar.bz2 | |
doc($log): fix the $log service example
is no longer auto-published on the root scope, so we need to publish
it via a controller
Diffstat (limited to 'src/service')
| -rw-r--r-- | src/service/log.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/service/log.js b/src/service/log.js index b4d33bc9..09945732 100644 --- a/src/service/log.js +++ b/src/service/log.js @@ -15,13 +15,20 @@ * @example <doc:example> <doc:source> - <p>Reload this page with open console, enter text and hit the log button...</p> - Message: - <input type="text" name="message" value="Hello World!"/> - <button ng:click="$log.log(message)">log</button> - <button ng:click="$log.warn(message)">warn</button> - <button ng:click="$log.info(message)">info</button> - <button ng:click="$log.error(message)">error</button> + <script> + function LogCtrl($log) { + this.$log = $log; + } + </script> + <div ng:controller="LogCtrl"> + <p>Reload this page with open console, enter text and hit the log button...</p> + Message: + <input type="text" name="message" value="Hello World!"/> + <button ng:click="$log.log(message)">log</button> + <button ng:click="$log.warn(message)">warn</button> + <button ng:click="$log.info(message)">info</button> + <button ng:click="$log.error(message)">error</button> + </div> </doc:source> <doc:scenario> </doc:scenario> |
