问题
Currently if I want to reload a state, I have to use the $state.reload(). This causes a full page refresh, which is very unfriendly. I am looking for a way to just re-resolve my dependencies and reset the controller. Is this possible?
回答1:
Just to add on @Dag 's answer:
Do note, as of 0.2.14 you also have an option to just reload the current state and not it's parent.
So $state.go(people.search, {}, {reload: true});
would reload the people
state as well as all its childs.
While $state.go(people.search, {}, {reload: "people.search"});
would not reload the people
state but would reload people.search
and its childs.
回答2:
you can try with:
$state.go($state.current.name, $state.params, { reload: true });
it will force transition even if the state or params have not changed without full page refresh. you can pass the state + the params + reload options.
for details look here at "go" method.
来源:https://stackoverflow.com/questions/32097221/ui-router-reload-state-without-a-full-page-refresh