karma-runner / karma-ng-html2js-preprocessor

A Karma plugin. Compile AngularJS 1.x and 2.x templates to JavaScript on the fly.
MIT License
266 stars 146 forks source link

Support for inline templates? #77

Open alferz opened 9 years ago

alferz commented 9 years ago

It looks like inline templating is not currently supported by the preprocessor. ie, templates inside a script id="tpl.html" type="text/ng-template" tag that are embedded in other HTML. Instead, the processor just lumps the entire HTML file into one object in the $templateCache. Is it possible to parse out the individual inline templates in some way or is this a future initiative?

jrharshath commented 8 years ago

Bumping this issue again. I've encountered the same issue as well.

I've got several simple templates related to a single module defined in a single html file, and all of them are defined in their own <script type='text/ng-template' id='template-id'> block. Each of these templates are referenced by a single a single directive using templateUrl: 'template-id' in their directive definition objects.

However, since ng-html2js simply puts the contents of entire files into the template cache, unit tests for those directives fail with the error Unexpected request: GET template-id.

It would be nice if ng-html2js could go through the html files supplied to it, and also put the inline templates found into the template cache.

jrharshath commented 8 years ago

Going through other open issues, I found that issue #31 is identical to this, so this can be closed.