I am trying to redirect inside a ui-router resolve and wanted to know if there is a way to reroute in a router resolver. Currently this does not work as one would think.
This is what I actually do, and I can't find a better solution
resolver($q, $timeout, myService) {
if(!areParameterValuesValid() || !isEverythingLogicallyOk()){
var deferred = $q.defer();
$timeout(function() {
$state.go('somewhere');
deferred.reject();
});
return deferred.promise;
} else {
return myService.loadSomething(passingSomeParams);
}
}