Is there a way to preload templates when using AngularJS routing?
问题 After the Angular app is loaded I need some of the templates to be available offline. Something like this would be ideal: $routeProvider .when('/p1', { controller: controller1, templateUrl: 'Template1.html', preload: true }) 回答1: There is a template cache service : $templateCache which can be used to preload templates in a javascript module. For example, taken from the docs: var myApp = angular.module('myApp', []); myApp.run(function($templateCache) { $templateCache.put('templateId.html',