Skip to content Skip to sidebar Skip to footer

Calling Adoptnode And Importnode On A Child Window Fails In Ie And Edge

Findings and Supporting Information Thanks to user4749485 for pointing out a link I missed in the comments below. As pointed out by the person who made it, it seems this is caused

Solution 1:

The solution isn't pretty. You need to compile it, get the HTML content, remove all occurrences of ngInclude, wrap it in a DIV, append the HTML string to the new window, and compile it again.

Plnkr: http://plnkr.co/edit/aGpN3LHllU2ReHp1zG26?p=preview

$scope.window= window.open('', '', '');
var windowScope= $scope.$new();
var body= angular.element($scope.window.document.body);
var contents= $compile($element.contents())(windowScope);
setTimeout(function(){
    // The div is needed// http://stackoverflow.com/a/38599093/631295
    body.append('<div>'+$element.html().replace(/ng-include="[^"]+"/g,'')+'</div>');
    windowScope.$destroy();
    windowScope= $scope.$new();
    $compile(body)(windowScope);
}, 1000);

Post a Comment for "Calling Adoptnode And Importnode On A Child Window Fails In Ie And Edge"