[英]Redirection to a web page not working in angularjs
I am trying to redirect when someone clicks on my hyperlink. 当有人单击我的超链接时,我试图重定向。 The address of the page appears in the address bar but it does not load.
该页面的地址出现在地址栏中,但不会加载。 Address is placed in a tag
{{tag}}
. 地址放置在标签
{{tag}}
。 Tag is set value using href
. 标签是使用
href
设置的值。
This Will Successfully Redirect as there is no # hash in url
这将成功重定向,因为url中没有#哈希
$scope.onButtonClick = function () {
$location.url('/controller2?dataId='+33);
}
This Will not Redirect Due To # hash in Url
由于网址中的#哈希值 ,因此无法重定向
So Add $location.reload();
因此添加$ location.reload();
It Will Change Url + navigate your page
它将更改网址+导航页面
$scope.onButtonClick = function () {
$location.url('#/controller2?dataId='+33);
$location.reload();
}
这对我在angularJs中有效
window.location.href = '/Controller/Action';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.