When angular jumps from route A to route B for the first time, the controller of route B will be initialized; when it jumps to route B for the second time, if the parameters in the route change, the controller of route B will be initialized again. Initialization is performed; if the parameters in the route do not change, the controller of route B will not be initialized again. How can we make the route initialize its controller every time it jumps?
`//The routing configuration is as follows:
.state('calendarUpdate',{
url:"/calendarUpdate?itemOid",
templateUrl:"templates/calendar/calendarUpdate.html",
controller:"CalendarUpdateCtrl"
})`
//跳转方式如下:
<a ui-sref=calendarUpdate({itemOid: itemOid})>跳转</a>
Have you used ionic? Ionic’s cache mode does not reload.
Add $watch
You made a mistake. Regardless of whether the parameters in the route have changed or not, the controller will be initialized. Follow the official angular tutorial: