angular-ui-router hook to execute logic before loading a state, possibly changing destination state