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>
给我你的怀抱2017-05-15 17:05:27
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:
For memory usage and performance considerations, the controller will only be instantiated when needed, and will be destroyed when no longer needed. This means that every time you switch routes or reload a view, the current controller will be cleared by AngularJS.