Sorry about the trouble, the example you are looking at is outdated
and it was a bad example altogether. A better one can be found here:
http://docs.angularjs.org/#!angular.directive.ng:click
In 0.9.9 we introduced several breaking changes [1] which were
necessary for any non-toy application.
If you wanted to really issue the alert command the code would look like this:
<!DOCTYPE HTML>
<html xmlns:ng="http://angularjs.org">
<head>
<script type="text/javascript"
src="http://code.angularjs.org/angular-0.9.9.js" ng:autobind></script>
</head>
<body>
<input type="button" value="Hello"
ng:click="$service('$window').alert('hello')">
</body>
</html>
if you needed access to $window more than once you should do this:
<!DOCTYPE HTML>
<html xmlns:ng="http://angularjs.org">
<head>
<script type="text/javascript"
src="http://code.angularjs.org/angular-0.9.9.js" ng:autobind></script>
</head>
<body ng:init="$window = $service('$window')">
<input type="button" value="Hello" ng:click="$window.alert('hello')">
</body>
</html>
In a real world app, you would have a controller and inject $window
into the controller like this:
function MyCtrl($window) {
this.$window = $window;
}
MyCtrl.$inject = ['$window'];
cheers,
Igor
[1] https://github.com/angular/angular.js/blob/v0.9.9/CHANGELOG.md
> --
> You received this message because you are subscribed to the Google Groups "Angular" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>