ng-html2js

3.0.0 • Public • Published

ng-html2js Analytics

Build Status Dependency Status

Standalone script to turn Angular template into js and put it in a module.

Usage

$ ng-html2js inputFile [outputFile] [-m moduleName] [--module-var ngModule]

If you specify only inputFile, it will display the result to the console.

If you don't specify moduleName, inputFile will be the name of the module.

$ ng-html2js test/test.tmpl
var module = angular.module('test/test.tmpl', []);
module.run(['$templateCache', function($templateCache) {
  $templateCache.put('test/test.tmpl',
    '<div>\n' +
    '  hello world\n' +
    '  <div ng-repeat="item in items">\n' +
    '    {{ item }} it\'s value is great\n' +
    '  </div>\n' +
    '</div>\n' +
    '');
}]);

If you specify moduleName, the template will belong to that module.

$ ng-html2js test/test.tmpl -m foo --module-var ngModule
var ngModule;
try {
  ngModule = angular.module('foo');
} catch (e) {
  ngModule = angular.module('foo', []);
}

ngModule.run(['$templateCache', function ($templateCache) {
  $templateCache.put('test/test.tmpl',
    '<div>\n' +
    '  hello world\n' +
    '  <div ng-repeat="item in items">\n' +
    '    {{ item }} it\'s value is great\n' +
    '  </div>\n' +
    '</div>\n' +
    '');
}]);

License

This seed is released under permissive MIT License.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    4,029
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    4,029
  • 2.0.0
    572
  • 1.2.0
    66
  • 1.1.0
    6
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i ng-html2js

Weekly Downloads

4,673

Version

3.0.0

License

MIT

Last publish

Collaborators

  • yaru22