https://github.com/yaru22/ng-html2js
Standalone script to turn Angular template into js and put it in a module.
https://github.com/yaru22/ng-html2js
Last synced: 10 months ago
JSON representation
Standalone script to turn Angular template into js and put it in a module.
- Host: GitHub
- URL: https://github.com/yaru22/ng-html2js
- Owner: yaru22
- Created: 2013-08-21T02:20:19.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-08-23T03:48:27.000Z (over 9 years ago)
- Last Synced: 2025-03-08T10:46:49.499Z (10 months ago)
- Language: JavaScript
- Size: 22.5 KB
- Stars: 32
- Watchers: 1
- Forks: 19
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-angular-components - ng-html2js - Standalone script to turn Angular template into js and put it in a module. (Uncategorized / Uncategorized)
README
ng-html2js [](https://github.com/yaru22/ng-html2js)
==========
[](http://travis-ci.org/yaru22/ng-html2js)
[](https://gemnasium.com/yaru22/ng-html2js)
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',
'
\n' +
' hello world\n' +
' \n' +
' {{ item }} it\'s value is great\n' +
' \n' +
'\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',
'
\n' +
' hello world\n' +
' \n' +
' {{ item }} it\'s value is great\n' +
' \n' +
'\n' +
'');
}]);
```
License
-------
This seed is released under permissive MIT License.