Using current user's location and restaurant location (geo-coordinates), user can tap a link to open Google Maps and get direction to the desired place. However when I use the back button of Android, it fails to return to the app, and then app is "stuck" within Google maps without the possibility to browse back in the app. How do I solve the problem ? - Working with AngularJS and Ionic.
Here is the hTML:
<ion-list>
<ion-item ng-controller="loadingCtrl" bindonce ng-repeat= "restaurant in restaurantList | orderBy: 'distance' " href="#">
<article class="item_frame">
<div class="marker_left_container">
<img class="venue_rest_marker" ng-src="{{restaurant.icon}}">
<span class="venu_type_text">{{restaurant.venueType}}</span>
<span class="distance_from_user_rest"> {{distanceTo(restaurant)}} km</span>
<span class="distance_from_user_rest2">from current location</span>
</div>
<div class="restaurant_details_container">
<h1 class="restaurant_name_inlist">{{restaurant.Name}}</h1>
<span class="restaurant_detail_inlist2">{{restaurant.subCuisine}}<br> {{restaurant.subsubCuisine}}</span>
<span class="restaurant_address">{{restaurant.address}}, <br> </span>
<span class="restaurant_address">{{restaurant.cp}}, {{restaurant.city}} <br><br></span>
<span class="restaurant_others">{{restaurant.phoneNumber}}<br> </span>
<span class="restaurant_others">{{restaurant.website}}<br> <br></span>
<div class="get_dir_container"><a href="https://www.google.com/maps/dir//{{restaurant.lat}},{{restaurant.long}}/">
<img src="img/get_direction_v3.png" class="get_dir_icon">
<span class="get_dir_text">Get direction on Google Maps</span>
</a></div>
</div>
</article><!--main article frame 1 -->
</ion-item>
</ion-list>
had found solution here :
.directive('browseTo', function ($ionicGesture) {
return {
restrict: 'A',
link: function ($scope, $element, $attrs) {
var handleTap = function (e) {
// todo: capture Google Analytics here
var inAppBrowser = window.open(encodeURI($attrs.browseTo), '_system');
};
var tapGesture = $ionicGesture.on('tap', handleTap, $element);
$scope.$on('$destroy', function () {
// Clean up - unbind drag gesture handler
$ionicGesture.off(tapGesture, 'tap', handleTap);
});
}
}
});
and within the HTML:
<button browse-to="https://www.google.com">Open Google</button>