First, I used ng-switch to control the display of the interface, and then directly defined herf="/region#create" on the new region button, and then changed the value of ng-switch to display different interfaces, but I don’t know why this happens, as shown below, that is, sometimes the interface does not jump when I click it for the first time, it just refreshes, and then the routing changes, so I must be configuring different ng -The routing is not configured properly when the switch displays the interface. The problem arises, so I want everyone to help me think about how to solve this problem, because the console is not displayed, and then the button function is executed again, but the value of ng-switch has not changed. It just doesn’t jump to the interface it should jump to. Moreover, this kind of error occurs once normally and once abnormally. Therefore, please provide me with ideas or methods to solve the problem. Because the code is too much and too confusing, I will not post the code here. Please forgive me. If Picture: Picture description
Open the console, check the error, and finally add, please use chrome to develop angular app
I don’t know how to write the code. There is something wrong with your routing jump. Directly using href to jump will definitely cause the page to refresh and the status will be lost. The hash part should be treated as an anchor point. For angular front-end routing, it can be Use
ui-router
.I suggest you use ui-router,
routing can be implemented as follows:
href is directly href="#create". You can read the official documentation for details. very convenient.
It is also recommended that you use ui-router