mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
docs($window): move use of $window to controller
Move use of `$window` from template to controller, because accessing `$window` in expressions is now disallowed and doesn't work. Closes #5110
This commit is contained in:
parent
1014e52349
commit
3abfb4ef51
1 changed files with 4 additions and 2 deletions
|
|
@ -20,13 +20,15 @@
|
|||
<doc:source>
|
||||
<script>
|
||||
function Ctrl($scope, $window) {
|
||||
$scope.$window = $window;
|
||||
$scope.greeting = 'Hello, World!';
|
||||
$scope.doGreeting = function(greeting) {
|
||||
$window.alert(greeting);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
<div ng-controller="Ctrl">
|
||||
<input type="text" ng-model="greeting" />
|
||||
<button ng-click="$window.alert(greeting)">ALERT</button>
|
||||
<button ng-click="doGreeting(greeting)">ALERT</button>
|
||||
</div>
|
||||
</doc:source>
|
||||
<doc:scenario>
|
||||
|
|
|
|||
Loading…
Reference in a new issue