mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-10 22:44:01 +08:00
docs($log): update example to use a module
This commit is contained in:
@@ -15,15 +15,16 @@
|
||||
* {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
|
||||
*
|
||||
* @example
|
||||
<example>
|
||||
<example module="logExample">
|
||||
<file name="script.js">
|
||||
function LogCtrl($scope, $log) {
|
||||
$scope.$log = $log;
|
||||
$scope.message = 'Hello World!';
|
||||
}
|
||||
angular.module('logExample', [])
|
||||
.controller('LogController', ['$scope', '$log', function($scope, $log) {
|
||||
$scope.$log = $log;
|
||||
$scope.message = 'Hello World!';
|
||||
}]);
|
||||
</file>
|
||||
<file name="index.html">
|
||||
<div ng-controller="LogCtrl">
|
||||
<div ng-controller="LogController">
|
||||
<p>Reload this page with open console, enter text and hit the log button...</p>
|
||||
Message:
|
||||
<input type="text" ng-model="message"/>
|
||||
|
||||
Reference in New Issue
Block a user