I experience rather strange behavior when trying to register the window object defined by $window.open() in AngularJS in $interval
self = this $scope.childWindow = $window.open(authService.buildAuthorizeUrl(), '_blank') console.log $scope.childWindow var1 = "I may not work" self.var2 = 'I should work' privateData.authInterval = $interval -> console.log $scope.childWindow console.log var1 console.log self.var2 , 1000
Exit
Window {document: document, window: Window, frameElement: null, clientInformation: Navigator, onhashchange: nullโฆ} Window {} I may not work I should work Window {} I may not work I should work
As you can see, the first console.log $scope.childWindow displays a fully qualified window object. All the rest, inside $interval , are output only {} . I tried not to attach childWindow to the $scope object, and I tried to attach it to self . I also tried the following this example and experienced the same behavior. Does anyone know why this is happening? Many thanks.
JSFiddle demo: http://jsfiddle.net/U3pVM/15124/
source share