Javascript 在windows open中从angularJS捕获url

Javascript 在windows open中从angularJS捕获url,javascript,angularjs,html,Javascript,Angularjs,Html,我的窗户有点问题 我必须创建一个windows.open。到目前为止,一切都很好,没有问题,细节是,这个新窗口是一个登录,在我登录时重定向我,我必须在那时捕获新的url 我的问题是,是否可以创建一个监听这个新窗口的变量?当我检测到url发生变化时,我会保存整个url 过程是 ->-> 登录后,我所要做的就是捕获代码。有可能这样做吗 $scope.rowAuthJSONConnect = function () { console.warn("Entrando

我的窗户有点问题

我必须创建一个windows.open。到目前为止,一切都很好,没有问题,细节是,这个新窗口是一个登录,在我登录时重定向我,我必须在那时捕获新的url

我的问题是,是否可以创建一个监听这个新窗口的变量?当我检测到url发生变化时,我会保存整个url

过程是

->->

登录后,我所要做的就是捕获代码。有可能这样做吗

      $scope.rowAuthJSONConnect = function () {
            console.warn("Entrando a rowAuthJSONConnect");
            console.warn("URL:");
            console.log(vm.URLRowAuthJson);

            var windowOpen = window.open('http://localhost:8520/pasar', "RedsysOpen", "width=900,height=600");

            console.log(windowOpen);

        }

您可以通过在父窗口中调用setter方法使子窗口更新父窗口中的URL,如下所示

    // define this method in main window (angular controller )
    window.setNewUrl = function(result) {
        console.log("new URL is : " + result);
    }

    //define the function below in the child window (the window that you opened with window.open)

    function sendUrlToParent() {
      try {
            window.opener.setNewUrl("new url here");
      } catch(e) {
            console.log("Exception setting value in parent " + e);
      }
    }

如果您想更新setNewUrl方法中的任何角度变量,我认为您需要调用$scope。$apply结束。

谢谢!正是我需要的。