1

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.

MajAfy
  • 3,007
  • 10
  • 47
  • 83
  • Please review this answer : http://stackoverflow.com/questions/34150840/inappbrowser-passing-a-callback-function/35601054#35601054 – A-Droid Tech Feb 24 '16 at 11:37

1 Answers1

1

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

jcesarmobile
  • 51,328
  • 11
  • 132
  • 176