docs($window): update example to use a module
This commit is contained in:
+8
-7
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user