angular第一次从A路由跳转到B路由时,B路由的控制器会初始化;第二次跳转到B路由时,如果路由中的参数变化了,则B路由的控制器再次进行初始化;如果路由中的参数没有变化,则B路由的控制器不会再次进行初始化。怎么样才能让,路由每次跳转都初始化一次它的控制器呢?
`//路由配置如下所示:
.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: