Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b7a7fc7

Browse files
committed
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
1 parent 21b2a5b commit b7a7fc7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/service/log.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@
1515
* @example
1616
<doc:example>
1717
<doc:source>
18-
<p>Reload this page with open console, enter text and hit the log button...</p>
19-
Message:
20-
<input type="text" name="message" value="Hello World!"/>
21-
<button ng:click="$log.log(message)">log</button>
22-
<button ng:click="$log.warn(message)">warn</button>
23-
<button ng:click="$log.info(message)">info</button>
24-
<button ng:click="$log.error(message)">error</button>
18+
<script>
19+
function LogCtrl($log) {
20+
this.$log = $log;
21+
}
22+
</script>
23+
<div ng:controller="LogCtrl">
24+
<p>Reload this page with open console, enter text and hit the log button...</p>
25+
Message:
26+
<input type="text" name="message" value="Hello World!"/>
27+
<button ng:click="$log.log(message)">log</button>
28+
<button ng:click="$log.warn(message)">warn</button>
29+
<button ng:click="$log.info(message)">info</button>
30+
<button ng:click="$log.error(message)">error</button>
31+
</div>
2532
</doc:source>
2633
<doc:scenario>
2734
</doc:scenario>

0 commit comments

Comments
 (0)