How to close a browser window in AngularJS

I have a login form that opens as a separate browser window. Once the API checks that the user is logged in, how do I close the login browser window in AngularJS?

+6
source share
2 answers

Use $window.close() in the $ window service.
You can broadcast the result to another controller, for example AngularJS - Communication between controllers

+13
source

First, the user will be asked to ask if they want to close the browser:

 $window.close() 

You want to enter the $window service in your controller / service. You can also use the javascript window global variable directly, but I prefer to use its "angular" and use only injective tools.

+3
source

Source: https://habr.com/ru/post/954737/


All Articles