Try it on Android, if the direct window.open (URL), click on the external link in the app does not have any reaction.
Installing Https://github.com/apache/cordova-plugin-inappbrowser
Execute command:
Ionic plugin Add Cordova-plugin-inappbrowser
In short, replace window.open with Window.cordova.InAppBrowser.open.
Steps:
1. When the application starts, determine if the Window.cordova is present if the window.open method is overridden
2. Replace the previous href with ng-click= "OpenLink (Story.url)"
3. Define the OpenLink method in $scope.
4. Connect your phone and run the ionic running Android test
File One: www/index.html
<div class= "List" > <a ng-click= "OpenLink (story.url)" class= "Item Item-thumbnail-left item-text-wrap" ng-repeat= "stories in stories track by Story.id" >
File Two: Www/js/app.js
(function () { var app = Angular.module (' Myreddit ', [' Ionic ', ' angularmoment ']); App.controller (' Redditctrl ', function ($http, $scope) { $scope. stories = []; function loadstories (params, callback) {... } $scope. loadolderstories = function () {... } $scope. loadnewerstories = function () {... } $scope. OpenLink = function (URL) { window.open (url, ' _blank '); } }); App.run (function ($ionicPlatform) { $ionicPlatform. Ready (function () { ... if (Window.cordova && window.cordova.InAppBrowser) { window.open = Window.cordova.InAppBrowser.open; } ... }); })}) ();
Open an external Web site in the Ionic app (using the Inappbrowser plugin)