I am having issues binding to events on the inAppBrowser in my ionic app. So far, my controller looks like this:
angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope, Auth, User, $http) {
$scope.title = "Dashboard";
var ref = window.open('#/login', '_blank', 'location=no');
ref.addEventListener('loadstart', function() { console.log(event.url); });
ref.addEventListener('loadstop', function() { console.log(event.url); });
Auth.authenticate().then(function(response) {
console.log('authenticated')
});
})
.controller('LoginCtrl', function($scope, Auth) {
console.log('hi');
})
The new window is opened correctly, which has a form like so:
<nav-page title="title">
<content has-header="true">
<form method="post" action="http://localhost:3000/user_session">
<input type="hidden" name="domain" value="fake.com">
<input type="hidden" name="openid_provider" value="google_apps">
<button type="submit">Submit</button>
</form>
</content>
</nav-page>
Which goes through a standard Google Apps Open ID redirect process and eventually logs in, but inside the child view. I would like to be able to intercept the redirects from this child view and access the params in my main controller.
During the redirect process in the child browser, I would expect the following lines to be creating alerts but nothing happens:
ref.addEventListener('loadstart', function() { console.log(event.url); });
ref.addEventListener('loadstop', function() { console.log(event.url); });
Am I constructing this incorrectly or is this an issue within Cordova possibly?
Any help would be greatly appreciated, Thank You!