Factory
.factory('authHttpResponseInterceptor',['$q','$location','$rootScope',function($q,$location, $rootScope){
return {
responseError: function(rejection) {
if (rejection.status === 401) {
console.error("Response 401 in interceptor ");
$('.modal-logout').modal({
backdrop: 'static',
keyboard: false
});
$('.modal-logout').modal('show');
}
if (rejection.status === 403) {
console.error("Response 403 in interceptor");
$scope.errorMessages.push("You are not authorized to perform this action.");
}
return $q.reject(rejection);
},
i want to inject the $scope here to display the 403 error message but i am unable to inject. i want to push the message into my errorMessage array which is defined in controller. how can i achieve the same.