I've been developing a mobile app using the ionic framework and AngularJS. I utilized the $ionicActionSheet for adding social links, which is working well. However, I'm facing an issue with opening these social links in new tabs when clicked. I attempted to use anchor tags and the $window.open() function but had no success.
Here is the code snippet:
app.controller('socialController', function($scope, $ionicActionSheet, $window) {
$scope.showActionsheet = function() {
$ionicActionSheet.show({
titleText: 'Social',
buttons: [
{ text: '<a href="https://www.facebook.com" target="_blank"> <i class="icon ion-social-facebook"></i> Facebook </a>' },
{ text: '<a href="https://twitter.com" target="_blank"> <i class="icon ion-social-twitter"></i> Twitter </a>' },
{ text: '<a href="https://www.linkedin.com/" target="_blank"> <i class="icon ion-social-linkedin"></i> Linkedin </a>'},
{ text: '<a href="http://www.youtube.com" target="_blank"> <i class="icon ion-social-youtube"></i> Youtube </a>' }
],
cancelText: 'Cancel',
buttonClicked: function(index) {
/*if(index == '0') {
$window.open("https://www.facebook.com", "_blank");
return true;
} else if(index == '1') {
$window.open("https://twitter.com", "_blank");
return true;
} else if(index == '2') {
$window.open("https://www.linkedin.com", "_blank");
return true;
}else {
$window.open("http://www.youtube.com", "_blank");
return true;
}*/
return true;
}
});
}
})
If anyone has any suggestions on how to resolve this issue or what I might be doing wrong, please feel free to provide your input. Any help or advice is greatly appreciated.