简体   繁体   中英

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 is set value using href .

This Will Successfully Redirect as there is no # hash in url

$scope.onButtonClick = function () {
     $location.url('/controller2?dataId='+33);
}

This Will not Redirect Due To # hash in Url

So Add $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';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM