ng-templatecache

0.1.4 • Public • Published

ng-templatecache

Convert Angular templates to $templateCache entries.

Installation

npm install --save ng-templatecache

Usage

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

  • entries The list of entries to be added to the cache, each containing path and content
  • module (default: "templates") sets the generate module name. false means don't create a module
  • prefix (default: '') Prefix to add to template paths
  • standalone (default: false) if true, the module will be created as angular.module('xxx', [])

Package Sidebar

Install

npm i ng-templatecache

Weekly Downloads

4

Version

0.1.4

License

BSD

Last publish

Collaborators

  • statianzo