In this lesson, we is going to learn what to interact and native components through Cordova plugins. We'll walk through how to add a Cordova plugin to our application and use it for interact with our native device. In this case, we is going to install a plugin that would allow us to open URLs in a mobile browser from within our Ionic a Pp.
When your use of a link to open a webpage in Mobile ionic app, you'll find there is the no-on-the-back app.
<href= "https://google.fi">Go google, cannot come back the This app any More</a>
To solve this problem, we need to install a plugin:
NPM I--save-dev Cordova-plugin-inappbrowser
To check whether the plugin is successfully installed, you can do:
Ionic Plugin
It would list all the plugins and installed fot the application.
Now, let's try to open the link in browser instead for from app:
< a href = "https://google.fi" > Go Google, you cannot come-this app any More</ a > < button ion-button color = "secondary" (click) = "Openinappbrowser ()" > Open in Browser</ >
Openinappbrowser () { = "https://www.google.fi"; ' _system '); }
Now upload the application to Ionic view:
Ionic upload
From the mobile phone, sync to latest version.
And we can confrim that if we click the button, this time, mobile would open the browser to display the page.
[Ionic2] Device Interaction in a Ionic App with Cordova Plugins