In an application that I am doing, I was asked to open the application from the browser. Install the plugin cordova-plugin-customurlscheme
to define this and it works perfectly.
From the browser, I receive certain values when the application is opened, try to define the function handleOpenURL
within the controller, but I receive the error:
Uncaught ReferenceError: handleOpenURL is not defined at: 1: 1
I was investigating this error and it is solved adding it in the file index.html
as a <script>
staying like this:
<script>
handleOpenURL = function (url) {
setTimeout(function(){
alert(url);
},0);
};
</script>
However, upon receiving the URL I would like to obtain the parameters, for example I receive the alert
miapp://?parametro=valor
And I would also like to handle events of angularjs
as redirect or send an alert ionic
, however I do not know if you can access a function of a controller outside of it, if this happens to be bad practice or some possible solution.