Questions tagged [ng-html2js]

ng-html2js is a preprocessor for converting HTML files to AngularJS templates. It converts HTML files into JS strings and generates Angular modules. These modules, when loaded, put these HTML files into the $templateCache and therefore Angular won't try to fetch them from the server. For instance template.html will be served as template.html.js:

ng-html2js is a preprocessor for converting HTML files to AngularJS templates.

It converts HTML files into JS strings and generates Angular modules. These modules, when loaded, put these HTML files into the $templateCache and therefore Angular won't try to fetch them from the server.

For instance template.html will be served as template.html.js:

41 questions
0
votes
0 answers

angular+TS+jasmine+ng-html2js = 'Failed to instantiate module templates'. How to instantiate templates? Where is it forms?

Trying to unit test angular's 1 directive with template in separate file. Using jasmine and ng-html2js to stash html templates in $templateCache. On a project without SystemJS one can use: beforeEach(module('MyStupidModule', 'templates')) where…
0
votes
1 answer

How do I get templateURLs to work with angular?

Before I get redirected to the countless duplicate questions. I want everyone to know I've checked them and tried their solutions but it doesn't work for me. I think the issue is with my path, but the way our project is setup I can't seem to figure…
lmcadory
  • 2,149
  • 3
  • 14
  • 15
0
votes
1 answer

Unit testing form templates with directives returns "Error: [$injector:unpr] Unknown provider:"

I'm creating a unit test form my form validation. In my main form template controller, I am mocking the injected service. And the form template also contains a directive that injects the same service. I am using html2js to load my html…
nix
  • 3,262
  • 2
  • 21
  • 36
0
votes
1 answer

Can't get ng-html2js to properly work with karma + jasmine + phantomjs

I've been trying to configure ng-html2js to work for my simple directive testing (whole project source can be found here). The relevant pieces of code are: angular\karma.conf.js module.exports = function(config) { config.set({ basePath:…
Jesús Cruz
  • 192
  • 2
  • 18
0
votes
1 answer

html2js preprocessor stripping multiple prefixes

I have a file structure where the templates are located in different folders but the build task puts them all into a single folder. I wish to strip all the different prefixes from the files and prepend the correct build prefix. This works to load…
JordanC
  • 131
  • 1
  • 1
  • 10
0
votes
1 answer

using ng-include along with $templateCache not finding file

I have a directive, where I'm trying to dynamically load different partials depending on an object that is injected into directive function countSummary() { var directive = { scope: { countData: '=' }, link:…
Jon Harding
  • 4,928
  • 13
  • 51
  • 96
0
votes
1 answer

karma-ng-html2js-preprocessor injector error

I have been browsing many questions regarding this problem and I still haven's figure this out. (vojtajina/ng-directive-testing didn't help much as well). karma.conf.js preprocessors: { 'app/components/partials/*.html':…
user5091161
0
votes
2 answers

Issue with Directives Templates?

I keep getting this error when trying to run unit-tests on my directives: Error: Unexpected request: GET /assets/partials/project-brand.html No more request expected I'm stumped on what may be causing this issue. Here is my karma.conf.js: files:…
0
votes
1 answer

ngHtml2Js remove multiple module run definitions from result

I have the following gulp task: gulp.task('html', function () { // Compile templates return gulp.src(templateFiles) .pipe(htmlmin({ removeComments: true, collapseWhitespace: true, …
Øystein Amundsen
  • 3,993
  • 8
  • 44
  • 63
0
votes
1 answer

How minify an Angular Prj

This is my problem ... I prepare the next small exmaple, with the gruntFile.js and i can get minify this this is the error that i have: Uncaught Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or…
julioVG
  • 81
  • 1
  • 12
0
votes
2 answers

Unit testing an Angular Directive

I'm trying to unit test all the directives using karma and jasmine. When I try to load a directive, which has a template called header.html, I get the following error: Error: Unexpected request: GET header.html No more request…
user730009
  • 313
  • 1
  • 5
  • 18
1 2
3