MajAfy
MajAfy

Reputation: 3097

open InAppBrowser on ionicModal

I want open a web page in my app, I know I should use ngCordova InAppBrowser plugin, but how can I open the webpage in $ionicModal ? like twitter, facebook mobile apps and ...

I have this button :

<button class="button button-block button-assertive" ng-click="doPay()">Pay</button>

and in doPay() I have :

$scope.doPay = function(){
    window.open(url, '_system', 'location=no');
};

but this code use external app (Safari), I want open in my application.

Upvotes: 1

Views: 3423

Answers (1)

jcesarmobile
jcesarmobile

Reputation: 53351

To open the web inside your app you have to use the _blank option instead of _system

$scope.doPay = function(){
    window.open(url, '_blank', 'location=no');
};

Edit: window.open no longer works as default, to re enable it you’ll need to add this code

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    window.open = cordova.InAppBrowser.open;
}

Or use cordova.InAppBrowser.open instead of window.open

Upvotes: 1

Related Questions