javascript - Include an angular template in another using webpack -


i have issue using angular , webpack. project composed of multiples views controllers.

for example, have view usersummary.tmpl.html load list of users. reuse template in groupsummary.tmpl.html display users too.

i can't use ng-include because views contained in bundle.js, nothing else. use webpack include views directly in another.

is possible?

to enable must configure "relativeto" parameter, otherwise template partials loaded @ "/home/username/path/to/project/path/to/template/" (check bundle.js you're leaking username in projects)

var ngtemplateloader = (     'ngtemplate?relativeto=' + path.resolve(__dirname, './src/') +     '!html' );  module.exports = {     ...     module: {         loaders: [             {test: /\.html$/, loader: ngtemplateloader},         ],     },     ... } 

then in code, side-effect require:

// src/webapp/admin/js/foo.js require('../../templates/path/to/template.html'); 

then can load html:

<div ng-include src="'/webapp/templates/path/to/template.html'"</div> 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -