Ionic的InnapBrowser无法正常工作

时间:2015-07-14 16:33:58

标签: angularjs cordova ionic-framework ionic cordova-plugins

我使用InappBrowser插件在我的应用程序中打开网站页面。问题是当你触摸项目时,InappBrowser没有返回,或者ADB错误日志,而在Web浏览器中,使用离子服务进行测试,通常是有效的...这里代码:

HTML:

<ion-item ng-repeat="item in posts | filter: query" class="item-thumbnail-left item-text-wrap item-icon-right item-noticia" ng-click="urlchange('{{item.permalink}}')">
        <img class="thumb-noticia" data-ng-src="{{item.thumbnail}}">
        <h2> {{item.title}} </h2>
        <p>{{item.excerpt | limitTo: 100}}...</p>

        <ion-option-button class="button-dark button-facebook" ng-click="shareAnywhere()">
                <i class="icon ion-social-facebook icon-facebook"></i>
        </ion-option-button>
        <ion-option-button class="button-dark button-whatsapp" ng-click="shareAnywhere()">
                <i class="icon ion-social-whatsapp-outline"></i>
        </ion-option-button>
</ion-item>

AngularJS:

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

1 个答案:

答案 0 :(得分:1)

无论如何,我再一次自己决定了这个问题......

结果:

在命令行中:

ionic plugin add cordova-plugin-inappbrowser

AngularJS:

$scope.urlchange = function($url, $rootScope){
    cordova.InAppBrowser.open($url, "_blank", "location=no", "clearcache: no", "toolbar: no");
}

HTML:

<ion-item ng-repeat="item in posts | filter: query" class="item-thumbnail-left item-text-wrap item-icon-right item-noticia" ng-click="urlchange('{{item.permalink}}')">