0
我正在做一個離子應用程序,我想在系統瀏覽器中打開url,我已經安裝了離子inappbrowser插件,但我不知道如何使用它可以幫助我一些代碼。如何使用inappbrowser在離子應用程序中打開URL?
我想在瀏覽器中打開{{object.url}}。
我使用離子1
HTML
<body ng-app="newsapp" ng-controller="newscontroller">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Tech Crunch</h1>
</ion-header-bar>
<ion-content>
<section class="list">
<article ng-repeat="object in news">
<a navigate-To="{{object.url}}" class="item item-thumbnail-center">
<img ng-src="{{object.urlToImage}}" height="100%" width="100%">
<h2 class="nowhitespace">{{object.title}}/</h2>
<p class="nowhitespace">{{object.description}}</p>
<h6><i>Published At</i> {{object.publishedAt}}</h6>
</a>
</article>
</section>
<ion-infinite-scroll on-infinite="loadMore()" distance="1%">
</ion-infinite-scroll>
</ion-content>
</ion-pane>u
</body>
app.js
var app = angular.module('newsapp', ['ionic']);
.directive("navigateTo",function($ionicGesture){
return{
restrict: 'A',
link:function($scope,$element,$attr){
var tapharndle = function(e){
var inAppBrowser = window.open{encodeURI{$attr.navigateTo},'_blank','location=yes','toolbar=yes'};
};
var tapGesture = $ionicGesture.on{'tap',tapharndle,$element};
}
}
})
$http({
method: "GET",
url: "https://newsapi.org/v1/articles?source=techcrunch&
sortBy=latest& ``apiKey=90b77760d33d4c76af4c6c53862c9e72"
}) .then(function(newsdata){
angular.forEach(newsdata.data.articles, function(newsarticle) {
$scope.news.push(newsarticle);
});
$scope.lastarticleID= newsdata.data.lastID;
//$scope.news =newsdata.data.articles;
console.log(newsdata);
})
});
我不明白它可以解釋 –
我只需要在我的JS添加此代碼..? –
穆罕默德我不明白,這就是爲什麼我在這裏問你 –