I would like to change the property of an element inside iframe in angular 2 typescript similar to the javascript code
document.getElementById('iframeId').window.document.getElementById('home-grid').style.visibility = "hidden";
My Angular typescript code:
var iframe = document.getElementById('iframeId');
var insideDoc = iframe.contentDocument || iframe.contentWindow.document;
Error on compiling the code:
stream.js:74
throw er; // Unhandled stream error in pipe.
^
Error: ./angularapp/web/component/mainPage/mainPage.ts
←[37m(←[39m←[36m35←[39m,←[36m32←[39m): ←[31merror TS2339: Property 'contentDocument' does not exist on type 'HTMLElement'.←[39m./angularapp/web/component/mainPage/mainPage.ts
←[37m(←[39m←[36m35←[39m,←[36m58←[39m): ←[31merror TS2339: Property 'contentWindow' does not exist on type 'HTMLElement'.←[39m
Is there any way to achieve this in angular 2? Please help