javascript - Window object cleared on $Interval -
i'm experiencing rather weird behavior when trying log window object defined $window.open()
in angularjs within $interval
self = $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
output
window {document: document, window: window, frameelement: null, clientinformation: navigator, onhashchange: null…} window {} may not work should work window {} may not work should work
as can see, first console.log $scope.childwindow
outputting defined window object. others, inside $interval
, outputting {}
. i've tried not attaching childwindow
$scope
object, , i've tried attaching self
. i've tried following this example , experienced same behavior. have idea why happening? much.
jsfiddle demo: http://jsfiddle.net/u3pvm/15124/
i tried code in browser , while setting debug point inside $interval function empty object getting logged in console watch inspector on right shows $scope.childwindow not empty. might able use $scope.childwindow.
Comments
Post a Comment