We're using angular-ui-router (version 0.2.10 i believe).
There are two primary ways to arrive at a state,
- a) a user hits / ammends the url which corresponds to a state
- b) code somewhere e.g. controller invokes $state.go().
We would like in case a) to validate the state (e.g. is it valid according to one or more business rules), but not to do so in case b) since we're pretty sure that our application will only transition to valid states.
Case a) will often require an http round trip to perform validation which we'd like to avoid if possible.
How would this be implemented?
Thanks!