在 ionic 中单击 link 时如何在应用程序内打开网页?
How to make a webpage open inside the app when clicked a link in ionic?
我正在开发一个离子应用程序,我有一些网站链接列表,想在应用程序内部打开它。但是当我尝试这个时,它将需要单独的移动浏览器。有什么办法可以做到这一点?
请帮忙。离子新手
<div class="list">
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 1
</a>
</button>
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 2
</a>
</button>
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 3
</a>
</button>
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 4
</a>
</button>
</div>
它不会那样工作,你需要为此安装 cordova 应用内浏览器插件。find it here
安装插件后,在 app.js 中定义一个控制器。
它会起作用。
编辑更多描述:
打开你的 nodejs 命令提示符
cd yourApp
类型
cordova plugin add cordova-plugin-inappbrowser
会安装cordova inapp浏览器插件
// Add this to your app.js
.controller("ExampleController", function ($scope) {
$scope.openCordovaWebView = function()
{
window.open('http://google.com','_self');
};
});
// this to your html page
<ion-content ng-controller="ExampleController">
<button class="button button-full button-assertive"
ng- click="openCordovaWebView()">
Website 1
</button>
</ion-content>
我正在开发一个离子应用程序,我有一些网站链接列表,想在应用程序内部打开它。但是当我尝试这个时,它将需要单独的移动浏览器。有什么办法可以做到这一点? 请帮忙。离子新手
<div class="list">
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 1
</a>
</button>
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 2
</a>
</button>
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 3
</a>
</button>
<button class="item button button-assertive">
<a href="https://www.google.co.in/">
website 4
</a>
</button>
</div>
它不会那样工作,你需要为此安装 cordova 应用内浏览器插件。find it here
安装插件后,在 app.js 中定义一个控制器。 它会起作用。
编辑更多描述:
打开你的 nodejs 命令提示符
cd yourApp
类型
cordova plugin add cordova-plugin-inappbrowser
会安装cordova inapp浏览器插件
// Add this to your app.js
.controller("ExampleController", function ($scope) {
$scope.openCordovaWebView = function()
{
window.open('http://google.com','_self');
};
});
// this to your html page
<ion-content ng-controller="ExampleController">
<button class="button button-full button-assertive"
ng- click="openCordovaWebView()">
Website 1
</button>
</ion-content>