<button class="btn btn-default" ng-click="openModal()">Open Iframe</button>
<div id="omniScriptModal" class="modal">
<div class="iframe-close" ng-click="closeModal()">Close</div>
<iframe id="omniScriptIFrameModal" frameborder="0" allowfullscreen
src="ExternalLink"></iframe>
</div>
The Iframe has tabs and on click of certain button click inside tab, I need the model omniScriptModal to close.
$scope.openModal = function(){
document.getElementById('omniScriptModal').style.zIndex = 1040;
var buttonComponent = document.getElementById('omniScriptIFrameModal').contentWindow.document.getElementById('IdentifyCaller_nextBtn');
buttonComponent.onclick = function ($scope) {
document.getElementById('omniScriptModal').style.zIndex = -1;
}
}
The problem with the above code is that, it does not work if the button is loaded little late or if the button inside iframe is in some other tab.