karma-ng-html2js-preprocessor icon indicating copy to clipboard operation
karma-ng-html2js-preprocessor copied to clipboard

need a way to inject template in script tag format

Open debuggingfuture opened this issue 11 years ago • 4 comments

I find this library a nice idea & soling the problem.

for some reason my templates are in the script tag format, which then include & pick up by PHP.

  <script type="text/ng-template" id="templateId.html">
    <p>This is the content of the template</p>
  </script>

with ng-html2js, the whole thing will be treated as the template itself i.e. $templateCache.get('templateId.html') will get the script tags as well

so the approach perhaps a script tag regex is good enough

debuggingfuture avatar May 08 '14 07:05 debuggingfuture

which sth like content = content.replace(/<script[^>]*>\n*/g,'').replace(/\n*<\/script>/g,''); at L20 html2js.js is good for me, assuming the id follow convention as in the path

debuggingfuture avatar May 08 '14 07:05 debuggingfuture

I also need support for this syntax, although to make it more complicated, I have multiple

script type="text/ng-template" in a single file, so I'll need to pull out the id's and add them to the template cache by id.

arkarkark avatar Aug 29 '14 10:08 arkarkark

@arkarkark thanks, I am using your branch which work nice for me

debuggingfuture avatar Sep 25 '14 03:09 debuggingfuture

This can be resolved if someone can create a new PR corresponding to #42 - or point me to some guide to contributing to this project, so I can do it myself.

jrharshath avatar Apr 04 '16 06:04 jrharshath