I have a login form that is popped up as a separate browser window. Once the API validates that the user is logged in, how do I close that login browser window in AngularJS?
Use $window.close()
in $window service.
You can broadcast the result to another controller like this AngularJS – Communicating Between Controllers
This will first prompt the user, asking them whether they want to close their browser:
$window.close()
You'll want to inject the $window
service into your controller/service. You can also use the global javascript variable window directly, but I prefer to do it the "angular" way and only use injectables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With