I'm encountering a weird issue on IE9. What I'm trying to do is opening a popup window from my page and attaching the scope of the page to the window object like:
angularApp.controller('ParentCtrl', function($scope, $window) {
$window.parentScope = $scope;
$window.open(url, popupName, params);
});
In my popup/child controller I'm using some property from the parent scope to populate data. Then in my popup page I have some controls which lets a user to pick certain persons from a multi select box. After the user clicks on Assign persons from the popup page I'm calling a method in my parent page like:
childApp.controller('ChildCtrl', function($scope, $window) {
$window.opener.parentScope.updatePersons($scope.personInfo);
}
The method updatePersons is defined in the ParentCtrl as:
$scope.updatePersons = function(personInfo){
$scope.$apply(function() {
$scope.personInfo = personInfo;
});
};
Until now everything works fine and the updated personInfo array is copied from popup to the parent page. Now when I again open the popup page from a button on the parent page the value of $scope.personInfo in ParentCtrl mysteriously gets set to undefined.
The personInfo array on the Parent page is used in a ng-repeat to show a tabular list of persons with their attributes and in IE9 I see undefined in all the columns of the table.
Apparently, Safari, Firefox and Chrome all work flawlessly and don't set the value of this scope variable to undefined when the popup page is clicked again. I've tried looking for a solution to this problem but have failed. I've put id="ng-app" at the root of my application and followed some IE caveats mentioned on angularJs project page but w/o any success. I would really appreciate any help from the community as it's a show stopper for my application.
I created a plunker to demo what I'm trying to achieve. Somehow the child page doesn't show parent scope values and the child can't update parent scope but that's working in my application.
http://plnkr.co/edit/E5pzzYOCMXHTK1huCAF5?p=preview
Thanks in advance for the help!