// in app.module.ts
providers: [
{ provide: Window, useValue: window }
]
// in component:
Then you can just inject it directly anywhere you want - e.g. in a service:
constructor(private window: Window) {
// ...
var myapp = angular.module("myapp", []);
myapp.controller("MyController", function($scope, $interval){
$interval(callAtInterval, 5000);
});
function callAtInterval() {
console.log("Interval occurred");
}