Skip to content

Instantly share code, notes, and snippets.

@ramingar
Last active August 26, 2015 07:49
Show Gist options
  • Save ramingar/6c3a94f39a053549727f to your computer and use it in GitHub Desktop.
Save ramingar/6c3a94f39a053549727f to your computer and use it in GitHub Desktop.
Función para abrir una aplicación nativa desde phonegap #phonegap #angular #window #open #native #window.open
<script>
// At the controller:
$scope.redirectToSystemApp = function (url, protocol) {
if (typeof protocol == 'undefined') {
window.open(encodeURI(url), '_system', 'location=yes');
preventDefault();
} else {
window.open(protocol + ':' + url, '_system');
}
};
</script>
<!-- Usage: -->
<ons-button modifier="light" class="show-map"
ng-click="redirectToSystemApp('0,0?q='+ activity.location, 'geo')">
</ons-button>
<div ng-click="redirectToSystemApp(organization.phone, 'tel')"></div>
<div ng-model="organization.email" ng-click="redirectToSystemApp(organization.email, 'mailto')"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment