Angular $window service
by Bhavin Surela
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.angularjs.org/1.0.0/angular-1.0.0.js"></script>
<div ng-controller="MyCtrl" id="big">
<h2>$window service</h2>
<a class="btn btn-primary" ng-click="$window.open('http://www.fine-der.net', 'galleryWindowSample', 'width=1100,height=600,menubar=no,toolbar=no,location=no,scrollbars=yes')">WindowOpen</a>
<button class="btn" ng-click="$window.alert(Alert)">ALERT</button>
</div>
CSS
#big{
min-height:1000px;
border:1px solid black;
}
JavaScript
var app = angular.module('myApp', []);
function MyCtrl($scope, $window) {
$scope.$window = $window;
$scope.Alert="Alert Message";
var disabler = $window.on('scroll',function(){
console.log('i am scrolling');
});
disabler();
}