docs($window): update example to use a module

This commit is contained in:
Brian Ford
2014-07-07 23:10:03 -07:00
parent 3b5f346314
commit df545d7eed
+8 -7
View File
@@ -16,17 +16,18 @@
* expression.
*
* @example
<example>
<example module="windowExample">
<file name="index.html">
<script>
function Ctrl($scope, $window) {
$scope.greeting = 'Hello, World!';
$scope.doGreeting = function(greeting) {
angular.module('windowExample', [])
.controller('ExampleController', ['$scope', '$window', function ($scope, $window) {
$scope.greeting = 'Hello, World!';
$scope.doGreeting = function(greeting) {
$window.alert(greeting);
};
}
};
}]);
</script>
<div ng-controller="Ctrl">
<div ng-controller="ExampleController">
<input type="text" ng-model="greeting" />
<button ng-click="doGreeting(greeting)">ALERT</button>
</div>