ngRoute: handle error when template loading fails
If I have a templateUrl in my route definition, and the URL is wrong, no particular error/exception handler is called. The code in ngRoute is:
template = $http.get(templateUrl, {cache: $templateCache}).
then(function(response) { return response.data; });
It would be convenient to be able to deal with an error at this point.
Or is the proper solution to use an HTTP interceptor and deal with the error there?
@provegard yes, we could log it or throw a minErr. What would you expect to happen when a template can't be fetched?
@pkozlowski-opensource I would expect there to be a facility similar to $exceptionHandler that would let me handle errors like this.
+1
Would be great +1
This throws the tpload error since 1.3, which can be accessed as the 4 parameter of $routeChangeError. It's catchable by an interceptor, too.