Last active
March 15, 2017 11:29
-
-
Save cjmamo/9092047 to your computer and use it in GitHub Desktop.
Safely Prevent Template Caching in AngularJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
app.run(function($rootScope, $templateCache) { | |
$rootScope.$on('$viewContentLoaded', function() { | |
$templateCache.removeAll(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
app.run(function($rootScope, $templateCache) { | |
$rootScope.$on('$routeChangeStart', function(event, next, current) { | |
if (typeof(current) !== 'undefined'){ | |
$templateCache.remove(current.templateUrl); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed my problem. Thanks