yaru22 / ng-html2js Goto Github PK
View Code? Open in Web Editor NEWStandalone script to turn Angular template into js and put it in a module.
Standalone script to turn Angular template into js and put it in a module.
the try catch
block is ugly. Besides it's possible for the developer to know for sure that the module was already declared at the time of running this script.
RT
Hi, I'm having an issue I don't quite understand while testing my Angular App with Karma + Jasmine.
I've added the following to my karma.conf.js file:
ngHtml2JsPreprocessor: {
stripPrefix: 'public/',
moduleName: 'directiveTemplates'
},
preprocessors: {
'public/js/**/*.html' : ['ng-html2js']
},
Now as I understand it, this automatically adds all matched html files to the $templateCache.
However the issue I am having is that in the following test file, my inject function does not run.
describe('My ui-router state', function() {
var state;
beforeEach(module('myModule'));
// This causes inject to not run
beforeEach(module('directiveTemplates'));
beforeEach(inject(
function($state) {
console.log('I log when directiveTemplates is commented out');
state = $state.get('landing');
}));
it('exists', function() {
// Error: cannot access property name of undefined
expect(state.name).toBe('landing');
});
});
Hey. I've created a browserify transform plugin based on this package. However, an issue arises with circular references to module
as described in this issue: javoire/browserify-ng-html2js#3
A possible solution would be to rename module
to something else, like ngModule
. It shouldn't really matter what since its only used internally in that module anyway.
What do you think?
From what I can tell this only support one file. I could probably invoke the module multiple times but each time I would get the ngModule lookup code. In my projects I have many html files that live close to their respective controllers.
I'll submit a PR if you think this functionality should be added.
Could you provide a version where minified source works too?
Your templateCache gets uglified when not using ["templateCache", function($t) {...} ]
or something
Bug or feature?
You also can't ged rid of the leading /
.
I see that strip-prefix was added sometime ago, but I don't see that in the released package. Was it released and I am missing something here ?
I wanted to use that feature.
thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.