karma-ng-html2js-preprocessor
karma-ng-html2js-preprocessor copied to clipboard
html2js-preprocessor adding relative template url
My project folder is at var/www/apps/angular/myproject
And the templates are in the templates folder under myproject.
So the template url is specified in the directive is "/template/directive.html"
So in the karma config I've written
ngHtml2JsPreprocessor: { stripPrefix: 'var/www/apps/angular/myproject', moduleName: "my.templates" },
And this config works. But I don't want to specify the full path to the project in the config because for some other environment this might change. But "myproject" folder will be always there.
So I tried with stripPrefix: '*/myproject', But it didn't work. Please tell me how I can fix it?
One way I got around this was to use Nodes path module.
I set this before the Karma configuration
var path = require('path');
Then set the basepath as
basePath: path.resolve(),
Might help until relative paths are available.
I set my base path to the root of the folder, './', and it fixed this issue.