Angularjs 角度选项卡在“ng include src”中使用缓存渲染模板

Angularjs 角度选项卡在“ng include src”中使用缓存渲染模板,angularjs,browser-cache,angular-ui-tabset,Angularjs,Browser Cache,Angular Ui Tabset,我一直在使用包含multitab视图的angular MVC应用程序。 我有一个带有一些templateURL选项卡的选项卡集 我为此所做的就是这样 $scope.templateUrl=; var tabs=$scope.tabs= []; var控制器=此; this.selectTab=函数选项卡 { $templateCache.puttab,tab.templateUrl; angular.forEachtabs、functiontab { tab.selected=false; }

我一直在使用包含multitab视图的angular MVC应用程序。 我有一个带有一些templateURL选项卡的选项卡集

我为此所做的就是这样

$scope.templateUrl=; var tabs=$scope.tabs= []; var控制器=此; this.selectTab=函数选项卡 { $templateCache.puttab,tab.templateUrl; angular.forEachtabs、functiontab { tab.selected=false; }; tab.selected=true; }; this.setTabTemplate=functiontab,templateUrl { $scope.templateUrl=$templateCache.gettab; } this.addTab=函数选项卡 { controller.selecttab; tabs.pushtab; };
缓存在第一次检索模板时自动完成

如果要预缓存它们,应将$http请求的缓存设置为bo$templateCache:

这是一个工作示例:

angular.module'myApp',[].controller'myCtrl',function$scope,$http,$templateCache{ $scope.templateUrl=; $scope.tabs=[]; $scope.selectTab=函数选项卡{ $scope.templateUrl=tab.templateUrl; }; $scope.addTab=函数选项卡{ $http.gettab.templateUrl,{cache:$templateCache}; $scope.tabs.pushtab; }; };
我已经为每个选项卡包含了单独的ng include,这对我很有用

<tabset> 
        <tab ng-repeat="tab in tabsMenu"  active="tab.active"> 
        <tab-heading> {{tab.title}} 
        <i ng-if =tab.closableTab class="glyphicon glyphicon-remove closeTabIcon" ng-click="removeTab($index)"></i> 
        </tab-heading> 
        <ng-include src="tab.url"></ng-include> 
        </tab> 
找到这把小提琴:


谢谢你的快速回复。我还有一个解决办法。{{tab.title}}它对meas有效,我为每个选项卡包含了单独的ng include DIV。
<tabset> 
        <tab ng-repeat="tab in tabsMenu"  active="tab.active"> 
        <tab-heading> {{tab.title}} 
        <i ng-if =tab.closableTab class="glyphicon glyphicon-remove closeTabIcon" ng-click="removeTab($index)"></i> 
        </tab-heading> 
        <ng-include src="tab.url"></ng-include> 
        </tab>