Exception in resolve function while transitioning to a new state in angularjs
I've a code to transition to new state on a button click, but one of the resolve functions is failing due to some error at the server. How and where should I handle this exception. I've tried the method described in this link https://github.com/angular-ui/ui-router/issues/1783, but it didn't help. I'm not sure if I'm doing it right or not. This is what my code looks like after taking it from the link, upon setting a break point and debug my code but I don't see the break point hitting on exception from the resolve function. Please correct me what am I doing wrong here or guide me in the right direction to get this resolved.
window.app = angular.module('app', ['di'])
app.run(['$rootScope',function($rootScope){
$rootScope.$on('$stateChangeError', function (event, toState, toParams, fromState, fromParams, error) {
if(toState.name == 'Categories')
{
// Do Something
}
});
}])
Route setting code
{
name: 'app.setting',
url: '/settings',
abstract: true,
component: 'settingDetails',
resolve: {
getData: ($stateParams,
$http)=>$stateParams.locationGroupId?$http.get(`/ui/getData/${
$stateParams.id
}/`).then(response=>response.data): [],
}
}