Javascript AngularJS:在ui路由器中加载视图后如何清除缓存?
你好,我有个小问题: 在AngularJS的ui路由器中加载视图后,如何清除缓存。 请帮帮我试试这个Javascript AngularJS:在ui路由器中加载视图后如何清除缓存?,javascript,angularjs,Javascript,Angularjs,你好,我有个小问题: 在AngularJS的ui路由器中加载视图后,如何清除缓存。 请帮帮我试试这个 app.run(function($rootScope, $templateCache) { $rootScope.$on('$routeChangeStart', function(event, next, current) { if (typeof(current) !== 'undefined'){ $templateCache.remove
app.run(function($rootScope, $templateCache) {
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (typeof(current) !== 'undefined'){
$templateCache.remove(current.templateUrl);
}
});
});
app.controller('mainController',函数($scope、$templateCache、$rootScope){
$scope.btnUpdate=函数(){
$rootScope.$on(“$viewContentLoaded”,函数(){
$templateCache.removeAll();
});
}
});代码>谢谢回复,我有一个问题,加载当前视图后如何重新加载它