0.1.4 • Published 11 years ago
ng-templatecache v0.1.4
ng-templatecache
Convert Angular templates to $templateCache entries.
Installation
npm install --save ng-templatecacheUsage
var templatecache = require('templatecache');
var myTemplate = '<div>Hello, {{firstName}}</div>';
templatecache.render({
entries: [{content: myTemplate, path: '/templates/greet.html'}],
module: 'templates'
});Results in
angular.module('templates').run(['$templateCache', function($templateCache) {
$templateCache.put('/templates/greet.html', '<div>Hello, {{firstName}}</div>');
}]);Options
entriesThe list of entries to be added to the cache, each containingpathandcontentmodule(default:"templates") sets the generate module name.falsemeans don't create a moduleprefix(default:'') Prefix to add to template pathsstandalone(default:false) iftrue, the module will be created asangular.module('xxx', [])