EXCEPTION:未捕获(承诺):错误:无法匹配任何路由:

时间:2017-12-05 01:47:10

标签: javascript jquery html angular angular-routing

  • 我正在努力学习angular2
  • 我正在尝试用that.router.navigate替换window.location.href,当我这样做时,我收到以下错误。
EXCEPTION: Uncaught (in promise): Error: Cannot match any routes: 'https%3A/login.stg.isports.com/Dreaminglogin/logoff.jsp%3Freferrer%3Dhttps%253A%252F%252Fjumping-auth.login.dancing.isports.com/logout.do%3Fredirect%3Dhttp%253A%252F%252Fqa.jumping.swimming.isports.com%26client_id%3Doooooooooooooooooooooooooooooo'
  • 你能告诉我如何解决它......
  • 提供以下代码的一部分和
  • codepen中的整个代码
  • 你能帮忙吗
  • 我尝试了所有可能的方法
  • 你能告诉我如何实施

https://codepen.io/arar/pen/qVvwaL

logOut(): void {
        let that = this;
        $(".kendoContent").text('Are you sure you want to exit the application?');
        let newdialog = $("#logOutDialog").data("kendoWindow").center().open();
        $("#logoutYes").unbind().click(function () {
            let userId;
            let attributes = that.sportsservice.getSeesionStorageValue();
            if (attributes) {
                userId = attributes.user_attributes.Dreaming[0];
            }
            //console.log(userId);
            let dateTime = that.sportsservice.todayDateWithTime();
            let saveUserTrackData = { "userId": userId, "screenId": 0, "actionId": 2, "comment": "Logout" };//,"currentTimeStamp" : dateTime};
            //that.progress.requestStart();
            //users/network/lastaccessed?timeStamp=6/02/2017 05:54:22 PM
            that.lastAccessCall(that);
            that.sportsservice.getResponse('users/network/saveusertrack', 'post', saveUserTrackData)
                .subscribe(
                data => {
                    // that.progress.requestEnd();
                },
                err => { //that.progress.requestEnd();
                }
                );
            let data = that.recentPinnedHistory.getRecentData('recentContract');
            if (data) {
                let postData = {
                    "recentHeros": data.recentData.recentHeros,
                    "pinnedHeros": data.recentData.pinnedHeros,
                    "pinnedContracts": data.recentData.pinnedContracts
                };

                that.sportsservice.getResponse("Heros/network/SPORTSRecentHeros", 'post', postData)
                    .subscribe(data => {
                    },
                    err => {
                        console.log("updating recent data failed");
                    }
                    );
            }

            that.sportsservice.clearSession();
            window.localStorage.removeItem("season");
            window.localStorage.removeItem("recentSPORTSHero");
            window.localStorage.removeItem("recentContract");
            window.sessionStorage.removeItem("userPrivilege");
            window.sessionStorage.removeItem("loginResponse");

            let baseUrl = window.location.hostname;
            //   let that = this;

            if (window.location.hostname == "localhost") {
                // let that = this;
                alert("I am here");

                baseUrl = 'qa.jumping.swimming.isports.com';
                //that.router.navigate('https://login.stg.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fjumping-auth.login.dancing.isports.com/logout.do?redirect=http%3A%2F%2F' #= baseUrl # '&client_id=oooooooooooooooooooooooooooooo');


                that.router.navigate(['https://login.stg.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fjumping-auth.login.dancing.isports.com/logout.do?redirect=http%3A%2F%2F' + baseUrl + '&client_id=oooooooooooooooooooooooooooooo']);

                //window.location.href = 'https://login.stg.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fjumping-auth.login.dancing.isports.com/logout.do?redirect=http%3A%2F%2F'+baseUrl+'&client_id=oooooooooooooooooooooooooooooo'; 

            } else {
                var envCheck;

                envCheck = window.location.hostname.split(".");

                if (envCheck[2].toLowerCase() == "swimming") {
                    window.location.href = 'https://login.stg.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fjumping-auth.login.dancing.isports.com/logout.do?redirect=http%3A%2F%2F' + baseUrl + '&client_id=oooooooooooooooooooooooooooooo';
                }
                else if (envCheck[2].toLowerCase() == "stars") {
                    window.location.href = 'https://login.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fauth-domain.login.sysstars.isports.com/logout.do?redirect=http%3A%2F%2F' + baseUrl + '&client_id=8dfcf377-83b7-4d5d-b403-aa65b78229f2';
                }
                else if (envCheck[2].toLowerCase() == "bat") {
                    //TEmporary URL
                    window.location.href = 'https://login.stg.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fjumping-auth.login.dancing.isports.com/logout.do?redirect=http%3A%2F%2F' + baseUrl + '&client_id=oooooooooooooooooooooooooooooo';
                }
                if (window.location.hostname == "new.jumping.isports.com") {
                    window.location.href = 'https://login.isports.com/Dreaminglogin/logoff.jsp?referrer=https%3A%2F%2Fauth-domain.login.sysstars.isports.com/logout.do?redirect=http%3A%2F%2F' + baseUrl + '&client_id=8dfcf377-83b7-4d5d-b403-aa65b78229f2';
                }
            }

            //that.router.navigate(['/Base']);
            //location.reload();
        });
        $("#logoutNo").unbind().click(function () {
            newdialog.close();
        });

    }

0 个答案:

没有答案