javoire / browserify-ng-html2js

Browserify transform to compile html templates into angular template modules
MIT License
27 stars 17 forks source link

exports filename instead of ngModule #31

Closed Schubidu closed 8 years ago

Schubidu commented 8 years ago

With this change you don't have to know the full generated filename of the directive.html. Just add something like var template = require('./template.html'); and you can use the template var to reference angular to the correct template.

javoire commented 8 years ago

Interesting change, I guess it works for this kind of module, where you actually want a module name (a string) as output from module.exports. 'Cause that's what angular wants in its module dependency array. Whereas most npm modules actually want to export the module (the code)

Schubidu commented 8 years ago

This modul is only useful with angular and angular always exports strings not a function, with this change you able to use in different ways: as dependency injection and as statement on directives templateUrl. Maybe in future you able to change the string directly in the module and save bits on output. Angular doesn't matter how the string looks like, if the string is unique.

Schubidu commented 8 years ago

@javoire will you merge this pull-request?

javoire commented 8 years ago

sorry for the delay :)

javoire commented 8 years ago

this addition makes so much sense, wonder why we didn't think about it before. Unless I'm missing something. Great job :+1: