I would like to copy my controller. I had the following code (invalid in angular 1.7):
link: function(scope, elm, attrs, ctrl) {
if (!ctrl) {
return;
}
// Do a copy of the controller
scope.ctrlCopy = {};
angular.copy(ctrl, scope.ctrlCopy); // <- fail here
This fails with:
Can't copy! Making copies of Window or Scope instances is not supported
I tried Object.copy but I need a prototype function of the controller ($setValidity)