N.M. N.M. - 1 year ago 92
AngularJS Question

require() an html file in browserify npm build

I see some issues when I'm using require() to include contents of an html file in my angular component. I'll copy paste only those sections that are relevant to the issue i am facing.

Here is what my top-nav component looks like.

angular.module('topNavModule', [])
.component('topNav', {
//bindings: {
template: require('./topNav.html')

When i add the top-nav component in my main index.html file i see [object Object]. Please note when i add the html inline (instead of require()) i see the HTML correctly.

My topNav.html is just some simple html code enclosed in `. Is there anything else i need to do to make require() html work correctly?

Answer Source

Ok, i was actually looking for partialify node module.

require()-able HTML, CSS, and (potentially) more require() file contents of HTML, CSS and (potentially) more into a variable as a string.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download