I started getting this error while developing a AngularJS component. This error from AngularJS sort of tells what the problem is, but does not tell where the problem is. The error was confusing and got me some time to decrypt the cause of the error.
Error: [ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported. http://errors.angularjs.org/1.2.16/ng/cpws at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:78:12 at copy (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:844:11) at copy (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:875:28) at copy (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:858:23) at copy (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:875:28) at copy (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:858:23) at Scope.$get.Scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:12250:47) at Scope.$get.Scope.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:12516:24) at HTMLDivElement. (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:18626:21) at HTMLDivElement.m.event.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js:3:8436)
My code was not making any explicit copies of the scope. Rather, it was the AngularJS runtime which was making the copies of the parent scope while expanding a ng-repeat tag. Further digging reveled that I had stored a reference of window.popup on my parent scope. AngularJS code does not support copying the Windows object, so as to avoid causing cyclic references. Removing this ‘Windows’ reference from the scope fixed this error.