-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get this to work with Angular 1.3.6 #30
Comments
This is my config module: //Setting up route
}]); |
Hey, in case you are still having problems with this (or anyone else needs an updated example), here's what I have, which works: var interceptor = ['$q', '$injector', '$timeout', '$rootScope', function($q, $injector, $timeout, $rootScope) {
return {
response: function(resp) {
var $http = $injector.get('$http');
if (!$http.pendingRequests.length) {
$timeout(function() {
if (!$http.pendingRequests.length) {
$rootScope.htmlReady();
}
}, 700); // Use .7s as safety interval
}
return resp;
}
};
}];
$httpProvider.interceptors.push(interceptor); However, if you're still getting the original template, its unlikely that this is the problem -- because the 10s timeout in the phantomjs script is probably sufficient for your HTML to get rendered. For me, when I had the old example and this was not doing anything, my template was still rendering, it just took 10s each time. Now it takes ~4s. |
Angular's $httpProvider.responseInterceptors is deprecated. I tried to use the new version which is $httpProvider.interceptors, but I cannot seem to get this to work. When I curl the application, I receive the original template.
The text was updated successfully, but these errors were encountered: