How to make angular ui-router's parent state always execute controller code when state changes?

夙愿已清 提交于 2019-11-28 20:15:55

To force a parent state to reload when navigate to him from a child state you can use both ways below. Pure js or a directive attribute.

<a ui-sref="myProfile" ui-sref-opts="{ reload: true }">Back to My Profile</a>

or

$state.go('myProfile', null, { reload: true });

Have you tried listening for the "$stateChangeStart" event and/or using $state.reload() ?

Seems like there is a bug on $state.go which is leaving out the reload options. $state.transitionTo however works for me.

$state.transitionTo('state',null,{reload: true});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!