Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I am here to discus my problem with my angularjs project. currently everything is working. Getting respose from APIs and setting data from API. but sometimes it get 400 error due to cache. after removing cache again works fine. so i want to build a code for when i refresh page caceh should be removed. I tried $templateCache but not working anymore.

enter image description here

share|improve this question
    
What makes you think those responses were cached? – duskwuff Nov 30 at 6:37
    
I am using a chrome extension ( Clear All Cache ) to one click remove caceh. after clearing cache and refreshing page. its working fine. – AWE Nov 30 at 6:42

try this

  app.run(function($rootScope, $templateCache) {
        $rootScope.$on('$routeChangeStart', function(event, next, current) {
            if (typeof(current) !== 'undefined'){
                $templateCache.remove(current.templateUrl);
            }
        });
    });
share|improve this answer
    
check attached pic for error – AWE Nov 30 at 6:32

If you are talking about development environment, you can disable browser cache when console is open.

enter image description here

I'm pretty sure Firefox and IE have that option too.

If you are talking about production environment, you'll need to look into javascript cache breaker.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.