Is it possible to fetch templates from $templateCache when configuring my $routeProvider?

前端 未结 3 1982
别那么骄傲
别那么骄傲 2021-02-13 16:32

My intention is to load all the templates of my web app with one single call to an external JSON file containing a list of all the template names and values.

I am curren

3条回答
  •  太阳男子
    2021-02-13 17:30

    if you use a HTTP interceptor, you can inject the $templateCache there:

        $provide.factory('myHttpInterceptor', ['$templateCache', function($templateCache) {
            return {
                request: function(config) {
                    // do fancy things with $templateCache here
                    return config;
                }
            };
        }]);
    

提交回复
热议问题