How to reload the current routing page in AngularJS, angularjs Routing

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.