Issue with opening external pages via. window.open()

Hey All,

This is my first post to the Forum. So take it easy on me… Im having an issue opening windows from inside the controller of my app using window.open(). I have a view that uses a series of if statements to show an alert if the url does not exist, an iframe if the link is able to be placed in one, or a browser window. When the view is rendered, it does indeed open the browser, however the app continues to try and open multiple instances, never really loading the first. Its as if the view keeps calling the function. Is there anyway to limit this to just one call.

This is my view :

<ion-view> ..<ion-content overflow-scroll="true" has-footer="true"> ....<div ng-if="::service_url == ''"> ......{{noUrlAlertAndRedirect('Service')}} ....</div> ....<div ng-if="::dealership.service_url != ''" style="height:95%;"> ......<div ng-if="::iframeFriendly == 0"> ........{{openLinkInBrowser(url, 'redirect')}} ......</div> ......<div class="holds-the-iframe" ng-if="::iframeFriendly == 1" style=""> ........<iframe id="iframe" ng-src="{{trustSrc(url)}}" width="100%" height="100%" sandbox="allow-same-origin allow-scripts allow-forms"> ........</iframe> ....ect

This is the function from my controller:

$scope.openLinkInBrowser = function(url, redirect){
..$ionicPlatform.ready(function() {
....var inAppBrowser = window.open(url, '_blank', 'location=yes'); ....inAppBrowser.addEventListener('exit', function(event){ ......$state.go(redirect); ....}); ..}); });

In my xcode logs I receive this error:
“Tried to show IAB while already shown”.

Thank in advance, any help will be greatly appreciated.