[英]window.location.href is not working on Internet Explorer browser?
I am writing a JavaScript code on click of a hyperlink using ng-click="method()" attribute on the anchor tag as below - 我正在使用以下锚标记上的ng-click =“ method()”属性在单击超链接时编写JavaScript代码-
<a href="" ng-click="method()">
<span>Get Started !! </span>
</a>
Inside method(), I am redirecting to another URL based on some condition as below 在method()内部,我根据以下某些条件重定向到另一个URL
service.activateUser($scope.patientId, $scope.activationCode).then(function (status) {
var endIndex = window.location.href.lastIndexOf("currentPage");
var nextPage={};
//For digital type patients, redirect to page1
if ($scope.patientType == 1) {
nextPage = window.location.href.substring(0, endIndex) + "page1";
}
//For analog type patients, redirect to page2
else {
nextPage = window.location.href.substring(0, endIndex) + "page2";
}
window.location.href = nextPage;
})
However, in Internet explorer, its throwing exception as "unhandled exception $rootscope.infdig". 但是,在Internet Explorer中,其抛出的异常为“未处理的异常$ rootscope.infdig”。
我添加了一个try catch块来包围我的代码,它起作用了:) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.