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
2
votes
1 answer

html2js stripPrefix user-based regex

I'm trying to use ng-html2js in order to fill my $templateCache to run some unit tests. Problem is, that my templates are located on a different project, and I use a relative path to them: preprocessors: { …
Luiz Rolim
  • 277
  • 2
  • 12
2
votes
0 answers

Unable to extract html from template.js created using grunt-html2js

I am using html2js with grunt in my application which is creating a template.js which comprises of all my html templates. I am using my app.js to get the templates for the files like this: .config(['$stateProvider', '$urlRouterProvider', …
Jyotirmoy Pan
  • 837
  • 2
  • 10
  • 28
2
votes
1 answer

ng-html2js doesn't work with Phantom, does work with Chrome

I'm using cg-angular to scaffold out my project. I'm testing a directive that uses templateUr, and ng-html2js to load my templates into a module. When I run my test using Chrome as the browser it passes no problem, but when I run it with Phantom I…
2
votes
1 answer

AngularJS directive test using ng-html2js

there are a lot of questions about the ng-html2js plugin but unfortunately all answers didn't help me to solve y issue. I followed the official installation guide and the example…
Sergio Rinaudo
  • 2,303
  • 15
  • 20
2
votes
1 answer

karma – angular unittesting directive with a templateUrl fails, even with ng-html2js with “unexpected request”

Now I'm getting: INFO [karma]: Karma v0.10.2 server started at `http://localhost:9876/` INFO [launcher]: Starting browser Chrome INFO [Chrome 30.0.1599(Linux)]: Connected on socket Q8d9RLBQDqi7wJ8iaKNw Chrome 30.0.1599 (Linux) directives Mydirective…
alonisser
  • 11,542
  • 21
  • 85
  • 139
2
votes
1 answer

Angular ng-bind-html-unsafe expression

Hi I'm using angular and I want to do an expression in my ng-bind-html-unsafe so that it can choose between two text to show. Is this the right syntax for the expression?
Here's a jsfiddle…
gsitu322
  • 117
  • 2
  • 10
1
vote
2 answers

Compile directive failing in AngularJS testing - karma jasmine

I'm using Karma with Jasmine Framework to test my AngularJS v1 app. I've set up ng-html2js plugin to convert partials into a module. I can access partials using $templateCache. When I try to compile the directive, I don't get anything though. The…
1
vote
1 answer

How to compile template HTML, and get beyond .html()?

Question: I would like to access the form within my template, and test it against validation, submit, etc. I believe I have the Karma/Jasmine test setup correctly, but I do not know how to access the form. test-module.view.html:
westandy
  • 1,360
  • 2
  • 16
  • 41
1
vote
0 answers

Trying to fix "Unexpected Request GET" with ng-html2js-preprocessor does not work

I want to test an angular directive with karma and jasmine. The directive uses an external template named complete.html. I try to get the html template with the following code: describe('directive', function ()…
user5864072
1
vote
0 answers

Adding relative template path for angular unit testing with ng-html2js-preprocessor

I've a angular directive with a template url. I'm trying to test the directive with karma. So get the html of the directive with ng-html2js-preprocessor . My project folder structure is var www myproject assets …
1
vote
1 answer

Why do I get a Lexer error while preprocessing my AngularJS template with ng-html2js

I'm trying to write a unit test for an AngularJS directive using Karma. To be able to use the directive's template in the test I use karma-ng-html2js-preprocessor. For the following template HTML I get a Lexer error message in the unit test, but in…
Markus Ende
  • 830
  • 1
  • 9
  • 21
1
vote
0 answers

karma-ng-html2js-preprocessor not able to GET template

I am trying to write a test for a simple directive that uses templateUrl. Here my folder structure: src main webapp assets css js partials cart …
Oam Psy
  • 8,555
  • 32
  • 93
  • 157
1
vote
0 answers

How to setup Gruntfile with html2js in my Yeoman project?

I guess the title is quite trivial. I have been develeoping with AngularJS for a while and used grunt only for some projects and it's only with yeoman. So I can say that I'm quite new to grunt. I have tried to follow the path in grunt-html2js page…
s.alem
  • 12,579
  • 9
  • 44
  • 72
0
votes
1 answer

AngularJS Componet testing with ng-html2js

Can someone help me with that problem: Angular project: gui_service/client/src/js/remoteGuiApp.js: angular.module('remoteGuiApp', ['ui.bootstrap', 'ngRoute', 'ngSanitize',…
Sergaros
  • 821
  • 1
  • 5
  • 14
0
votes
1 answer

karma angular templateUrl not found

I've some problems when testing angular directives with karma, the problem is that when comes from templateUrl never translate it. here is my karma.conf.js 'use strict'; var wiredep = require('wiredep'); var bowerFiles = wiredep().js; var appFiles =…