A directive to add validation to the pre-state-change of ui-router