IONIC 使用 inappbrowser loadstart 不工作

IONIC using inappbrowser loadstart not working

IONIC 使用 inappbrowser 不工作

var ref=   $cordovaInAppBrowser.open(url, '_self', options);        
ref.addEventListener('loadstart', function(event) {  
    alert(event.url); $ionicLoading.show() 
}); 
ref.addEventListener('loadstop', function(event) {  
    alert(event.url); 
    $ionicLoading.hide() 
});

尝试:

$ionicLoading.show();
$cordovaInAppBrowser.open(url, '_blank', inAppBrowserOptions);
  $rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event){
    $cordovaInAppBrowser.show();
    $timeout(function(){$ionicLoading.hide()},2000);
  });

对于 inAppBrowserOptions:

  .config(function($cordovaInAppBrowserProvider) {
    var defaultOptions = {
      location: 'yes',
      clearcache: 'no',
      hardwareback: 'yes',
      toolbar: 'no'
    };
    document.addEventListener("deviceready", function () {
      $cordovaInAppBrowserProvider.setDefaultOptions(defaultOptions)
    }, false);
  });