In angularjs is it possible to handle & resolve 404 Views?
I want to achieve conditional view rendering depending on my client, I have a view something like this:
<div ng-include="'assets/stackoverflow/breadcrumb.html'"></div>
so if suppose the above returns 404, it should try this:
<div ng-include="'assets/default/breadcrumb.html'"></div>
This approach may be wrong, but I just need a way to handle views 404, I have an interceptor which actually catches 404 requests but how do I resolve it and send it again?
app.factory('RequestResponseInterceptor', ['$q', '$rootScope', '$location',
function($q, $rootScope, $location) {
var loadingCount = 0;
return {
responseError: function(response) {
if (response.status === 404) {
//Change URL and request again
}
return $q.reject(response);
}
};
}
]);