Need to load templatecache JS file before hitting the routes so they load from templateCache

Posted in General by Brian McG Wed Aug 02 2017 14:49:30 GMT+0000 (UTC)·Viewed 146 times

So I am using ng-templates to create a $templateCache so that I can server my html partials from the templateCache instead of making XHR requests for them. It will also allow us to browser cache the HTML partials. Basically, ng-templates create a module for me like the one below; angular.module('AngTemplates', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('/App/Anon/Test/LoginPartial.html', "<div class=\"hero hero--xl fadeIn\"><div class=\"hero__inner\"></div>" ); } In my apps main module within its config block I am using the following to lazyload my templates module above $ocLazyLoadProvider.config({ //debug: true, modules: [{ events: true, name: 'AngTemplates', files: ['App/ang.templates.js'] }] }); Now my issue is that within my $routeProvider, I am trying to do a resolve to load the module, so that that when the code hits my routes because my templateUrl's match those in the templateCache within my module it should load them from the templateCache as opposed to making an XHR request. I can see the ang.templates.js file being loaded, however it seems like its either not being picked up or its too late in the process. Is what I am trying to do possible with oclazyload? Many thanks
Markdown is allowed