How to reload the current routing page in AngularJS, angularjs Routing
This question has also plagued me for a long time. I have answered a wide variety of questions online, and I have finally been searching for a long time online to find a solution from a great god; use ui-router to reload the current page. (The ui-router version must be 0.2.14 or later)
If angular is used as a project, you can click the menu to refresh the current page and load the current page. However, the same routing page does not respond;
Suppose our routing page app. toMenu;
<A href = "#" rel = "external nofollow" ui-sref = "app. toMenu "ui-sref-opts =" {reload: true} "> <! -- Refresh is generally said on the Internet, but the whole page is refreshed at the same time -->
In fact, in addition to passing Boolean parameters, reload can also pass string and object parameters. If you only want to refresh the current routing page, instead of refreshing the parent route, we can set the reload parameter value to the current route page ID.
<A href = "#" rel = "external nofollow" ui-sref = "app. toMenu "ui-sref-opts =" {reload: 'app. toMenu '} "> <! -- This method refreshes the current route page -->
You can also use $ state. reload ();
$ State. reload () is to load the entire page;
$ State. reload ('app. toMenu '); load the current page;
<A href = "" ng-click = "rel =" external nofollow "reloadCurPage ()"> <! -- $ Scope --> $ scope. reloadCurPage = function () {$ state. reload ('app. toMenu ') in the controller ');}
Note: If the identifier is a variable
<a href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" ui-sref="{{k.value}}" ui-sref-opts="{reload:'{{k.value}}'}">
The method for reloading the current routing page in AngularJS above is all the content shared by xiaobian. I hope to give you a reference, and I hope you can provide more support for the customer's house.