Hi I have a $stateProvider like below.
$stateProvider .state('team.details', {
url: '/:teamId',
views: {
'@': {
controller: 'teamDetailsCtrl',
templateUrl: 'src/modules/team/details/teamDetails.html',
resolve: {
user: function ($stateParams, TeamResource) {
return TeamResource.get({ teamid: $stateParams.teamId }).$promise;
}
The TeamResource.get is calling a rest api and everything is working fine if the data is sent from the rest api(teamid present in DB). But if the data is not present then I have to route it to a "home". How can i accomplish it ?