I'm having trouble loading templates from the $ templateCache template.
How I put templates in $ templateCache:
var app = angular.module('anglober', ['anglober.controllers', 'anglober.services', 'anglober.directives']).run(function ($templateCache, $http) {
$http.get('anglober/js/invitation/invitationModal.tpl.html', {cache: $templateCache});
$http.get('anglober/js/modal/ajaxModal.tpl.html', {cache: $templateCache});
$http.get('anglober/js/ajaxLoader/ajaxLoader.tpl.html', {cache: $templateCache});
$http.get('anglober/js/modal/modalContent.tpl.html', {cache: $templateCache});
$http.get('anglober/js/modal/simpleModal.tpl.html', {cache: $templateCache});
$http.get('anglober/js/mog/topMogs.tpl.html', {cache: $templateCache});
How do I download them:
angular.module('anglober.directives').directive('topMogs', ['$templateCache', function ($templateCache) {
return {
restrict : 'E',
template: $templateCache.get('topMogs.tpl.html')
};
}]);
In my network browser tab, I see that the templates load when the page loads.
However, when I call my directive, I get the following error:
One of template or templateUrl options is required.
What am I doing wrong?
thank
source
share