mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-10 07:44:43 +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>
|
<doc:source>
|
||||||
<script>
|
<script>
|
||||||
function Ctrl($scope, $window) {
|
function Ctrl($scope, $window) {
|
||||||
$scope.$window = $window;
|
|
||||||
$scope.greeting = 'Hello, World!';
|
$scope.greeting = 'Hello, World!';
|
||||||
|
$scope.doGreeting = function(greeting) {
|
||||||
|
$window.alert(greeting);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<div ng-controller="Ctrl">
|
<div ng-controller="Ctrl">
|
||||||
<input type="text" ng-model="greeting" />
|
<input type="text" ng-model="greeting" />
|
||||||
<button ng-click="$window.alert(greeting)">ALERT</button>
|
<button ng-click="doGreeting(greeting)">ALERT</button>
|
||||||
</div>
|
</div>
|
||||||
</doc:source>
|
</doc:source>
|
||||||
<doc:scenario>
|
<doc:scenario>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue