AngularJs 完美解决模板缓存 $templateCache

来源:互联网 发布:java中文gbk编码转换 编辑:程序博客网 时间:2024/05/18 06:19

////禁止模板缓存  

app.run(function($rootScope, $templateCache) {  

    $rootScope.$on('$routeChangeStart', function(event, next, current) {  

        if (typeof(current) !=='undefined'){  

            $templateCache.remove(current.templateUrl);  

        }  

    });  

});


app.config之后添加这段代码